Created
February 21, 2014 01:05
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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