Skip to content

Instantly share code, notes, and snippets.

@Tonyliu2ca
Forked from bruienne/logoutwatcher.sh
Created October 6, 2016 03:46
Show Gist options
  • Save Tonyliu2ca/d61306087ea088f14077f3b149a50499 to your computer and use it in GitHub Desktop.
Save Tonyliu2ca/d61306087ea088f14077f3b149a50499 to your computer and use it in GitHub Desktop.
logout watcher
onLogout() {
# Insert whatever script you need to run at logout
exit
}
echo "INFO - Watching ${HOME}" >> /var/log/org.my.log
trap 'onLogout' SIGINT SIGHUP SIGTERM
while true; do
sleep 86400 &
wait $!
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment