Skip to content

Instantly share code, notes, and snippets.

@dsjoerg
Created February 21, 2014 01:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dsjoerg/9126832 to your computer and use it in GitHub Desktop.
Save dsjoerg/9126832 to your computer and use it in GitHub Desktop.
This bash script runs every minute on my home server, keeps me from staying up too late.
#!/bin/bash
# Usage: enforcer.sh
curfew_active=`curl -s http://superego.herokuapp.com/api/v1/curfew/is_active`
curfew=`curl -s http://superego.herokuapp.com/api/v1/curfew/compute`
now=`date`
if [ $curfew_active == 'true' ]
then
echo "$now: GO TO SLEEP" >> /tmp/enforcer.log
sudo killall -u david -m 'Chrome|Hearthstone|SC2|Safari|Firefox'
else
echo "$now: CARRY ON until $curfew" >> /tmp/enforcer.log
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment