Advertisement
Guest User

Untitled

a guest
Jan 3rd, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.61 KB | None | 0 0
  1. #!/bin/busybox ash
  2. . /etc/init.d/tc-functions
  3. useBusybox
  4. # put user shutdown commands here
  5.  
  6. # If no backup of home was done then loop through valid users to clean up.
  7. if [ ! -e /tmp/backup_done ] || ! grep -q "^home" /opt/.filetool.lst; then
  8.   awk 'BEGIN { FS=":" }  $3 >= 1000 && $1 != "nobody" { print $1 }' /etc/passwd > /tmp/users
  9.   while read U; do
  10.     while read F; do
  11.       TARGET="/home/${U}/$F"
  12.       if [ -d "$TARGET" ]; then
  13.         rm -rf "$TARGET"
  14.       else
  15.         if [ -f "$TARGET" ]; then
  16.           rm -f "$TARGET"
  17.         fi
  18.       fi
  19.     done < /opt/.xfiletool.lst
  20.   done < /tmp/users
  21. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement