cron: for your health

Mar 13, 2022

I have a standing desk, but rarely stand. I have probably been sitting about 7 hours a day, which is too much! In the spirit of positive nudges for habit building and taking ownership over my notifications, I wrote a simple cron job to remind me to stand up every hour.

Note that this is mac-specific, but a Linux or Windows analog should be fairly easy to implement.

~/projects/cron/standup.sh

1
2
3
#!/usr/bin/env sh

osascript -e 'display alert "Stand up and stretch!"'

When run, a popup will be created in the middle of my screen that looks like:

standup.jpg

In order to run it periodically with cron, I ran crontab -e, then add this line to the file:

0 8-17 * * * ~/projects/cron/standup.sh > /dev/null 2>&1

Breakdown: