X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=usr%2Flocal%2Fbin%2Fvserver-hashify-all;h=5df03c256d99b8ce5ecb86a094233a9b388f5e4e;hb=61b1a0dad48afa04e388fa3a3eabf3f2440deedd;hp=e2df3b907c3e95c7897fa6e84b4bbb5c2697046c;hpb=815cae63c73a82e81f0b6193d0ddc756e9fa7b8f;p=matthijs%2Fservers%2Fdrsnuggles.git diff --git a/usr/local/bin/vserver-hashify-all b/usr/local/bin/vserver-hashify-all index e2df3b9..5df03c2 100755 --- a/usr/local/bin/vserver-hashify-all +++ b/usr/local/bin/vserver-hashify-all @@ -1,27 +1,25 @@ #!/bin/sh # The dir containing vserver configuration -VSERVERS_CONF=/etc/vservers +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 +for VDIR in "$VSERVERS_CONF"/*; do + NAME=`basename $VDIR` + # Check if its a config dir + if [ ! -d "$VDIR" ]; then continue; fi echo "Hashifying vserver $NAME..." - sudo vserver $NAME hashify + 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 +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 + sudo find -H "$HASH_DIR" -type f -links 1 -print0 | sudo xargs --null --no-run-if-empty rm fi done