From: Matthijs Kooijman Date: Thu, 16 Oct 2008 17:05:48 +0000 (+0200) Subject: vserver: Add a new script, vserver-hashify-all. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=d8d3807e173c433e69b58e1e7ee70baa8e1ad85b;p=matthijs%2Fservers%2Ftika.git vserver: Add a new script, 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..055cc51 --- /dev/null +++ b/usr/local/bin/vserver-hashify-all @@ -0,0 +1,30 @@ +#!/bin/sh + +# The dir containing vserver configuration +VSERVERS_CONF="/etc/vservers" + +for VDIR in "$VSERVERS_CONF"/*; do + NAME=`basename $VDIR` + # Check if its a config dir + if [ ! -d "$VDIR" ]; then + continue; + fi + + if [ ! -d "$VDIR"/apps/vunify ]; then + echo "Skipping vserver $NAME, hashify is disabled" + 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 --null --no-run-if-empty rm + fi +done