SLBR/deathwatch.sh

11 lines
291 B
Bash
Executable File

#!/bin/sh
# deathwatch.sh
# efficiently checks each user directory to see if the .ssh folder has been deleted
# deletes the user if it has
inotifywait -mrqe delete users | while read -r dir
do
echo "$dir" | grep -q 'ISDIR .ssh' \
&& ./deluser.sh "$(echo "$dir" | cut -f 2 -d '/')"
done