Skip to content

Instantly share code, notes, and snippets.

@nico-i
Last active March 19, 2024 10:32
Show Gist options
  • Save nico-i/bf52f9e889dd7cae49d1eaddfa3521ca to your computer and use it in GitHub Desktop.
Save nico-i/bf52f9e889dd7cae49d1eaddfa3521ca to your computer and use it in GitHub Desktop.
Display an intrusive prompt to drink water every 15min using a cron job
# - OSX / MacOS -
# Cron Job
*/15 * * * * osascript -e 'tell application (path to frontmost application as text) to display dialog "Drink some water. :]" buttons {"OK"}'
# Automatically add cron job to existing cron jobs
(crontab -l ; echo "*/15 * * * * osascript -e 'tell application (path to frontmost application as text) to display dialog \"Drink some water. :]\" buttons {\"OK\"}'") | crontab -
# as su
(sudo crontab -l ; echo "*/15 * * * * osascript -e 'tell application (path to frontmost application as text) to display dialog \"Drink some water. :]\" buttons {\"OK\"}'") | sudo crontab -
# - Fedora Linux -
# Cron Job
*/15 * * * * zenity --info --text "Have a sip of water (:"
# Automatically add cron job to existing cron jobs
(crontab -l ; echo "*/15 * * * * zenity --info --text \"Have a sip of water (:\"") | crontab -
# as su
(sudo crontab -l ; echo "*/15 * * * * zenity --info --text \"Have a sip of water (:\"") | sudo crontab -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment