diff --git a/opt/shutdown.sh b/opt/shutdown.sh index 9488f4c..d97969f 100755 --- a/opt/shutdown.sh +++ b/opt/shutdown.sh @@ -12,14 +12,17 @@ if [ ! -e /tmp/backup_done ] || ! grep -q "^home" /opt/.filetool.lst; then awk 'BEGIN { FS=":" } $3 >= 1000 && $1 != "nobody" { print $1 }' /etc/passwd > /tmp/users while read U; do while read F; do - TARGET="/home/${U}/$F" - if [ -d "$TARGET" ]; then - rm -rf "$TARGET" - else - if [ -f "$TARGET" ]; then - rm -f "$TARGET" + # don't do rm -rf /home/tc/ + if [ -n "$F" ]; then + TARGET="/home/${U}/$F" + if [ -d "$TARGET" ]; then + rm -rf "$TARGET" + else + if [ -f "$TARGET" ]; then + rm -f "$TARGET" + fi fi fi - done < /opt/.xfiletool.lst - done < /tmp/users + done < /opt/.xfiletool.lst + done < /tmp/users fi