From 815cae63c73a82e81f0b6193d0ddc756e9fa7b8f Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Thu, 16 Oct 2008 19:05:48 +0200 Subject: [PATCH] vserver: Add a new script, vserver-hashify-all. --- usr/local/bin/vserver-hashify-all | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 usr/local/bin/vserver-hashify-all diff --git a/usr/local/bin/vserver-hashify-all b/usr/local/bin/vserver-hashify-all new file mode 100755 index 0000000..e2df3b9 --- /dev/null +++ b/usr/local/bin/vserver-hashify-all @@ -0,0 +1,27 @@ +#!/bin/sh + +# The dir containing vserver configuration +VSERVERS_CONF=/etc/vservers + +cd $VSERVERS_CONF +for NAME in *; do + if [ ! -d $NAME ]; then + continue; + fi + if ! sudo vserver $NAME status &> /dev/null; then + continue; + fi + + echo "Hashifying vserver $NAME..." + sudo vserver $NAME hashify +done + +# Change to /tmp, to minimize the chance for an error to damage the root fs +cd /tmp +echo "Cleaning up unused hashed files..." +for HASH_DIR in $VSERVERS_CONF/.defaults/apps/vunify/hash/*; do + if [ -L $HASH_DIR ]; then + # All symbolic links + sudo find -H $HASH_DIR -type f -links 1 -print0 | sudo xargs -0 rm + fi +done -- 2.30.2