Created
September 17, 2013 21:28
-
-
Save sillygwailo/6600893 to your computer and use it in GitHub Desktop.
Line in /etc/crontab
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
# At the top of the hour, start a timer (sleep) every two hours | |
# between 8 AM and 6 PM. That timer lasts for a random duration of | |
# up to two hours. When that timer runs out, run a script that | |
# sends a notification to my iPhone or Android device to remind me | |
# to drink a glass of water. (And only on weekdays.) | |
0 8,10,12,14,16,18 * * 1,2,3,4,5 root sleep `/usr/bin/expr $RANDOM \% 7200`; python /full/path/here/water.py |
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
# 1. Creating an app to use with Pushover https://pushover.net/apps/build | |
# 2. Replace APP_TOKEN and USER_KEY with the app token and user key, respectively, from step #1. | |
# 3. Download the Pushover iOS or Android app and login from there. | |
# | |
# This is a slight modification of the example Python script at https://pushover.net/faq#library-python | |
# with the only change being the message sent over. | |
# | |
import httplib, urllib | |
conn = httplib.HTTPSConnection("api.pushover.net:443") | |
conn.request("POST", "/1/messages.json", | |
urllib.urlencode({ | |
"token": "APP_TOKEN", | |
"user": "USER_KEY", | |
"message": "Time for a glass of water", | |
}), { "Content-type": "application/x-www-form-urlencoded" }) | |
conn.getresponse() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment