Skip to content

Instantly share code, notes, and snippets.

@evancz
Last active December 25, 2020 13:18
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save evancz/550a94e9e262062cf64a6766a0445010 to your computer and use it in GitHub Desktop.
Save evancz/550a94e9e262062cf64a6766a0445010 to your computer and use it in GitHub Desktop.
Cron job to remind myself to stretch

Type crontab -l to see your cron jobs. Type crontab -e to edit them. You have to use Vim apparently.

Add a line like this:

0,30	*	*	*	*	/Users/YOURNAME/Documents/scripts/stretch.sh

That is on every 0th and 30th minute of the hour. Make sure all the separators in there are tabs!

#!/bin/bash
# Nonvisual cue in a relatively non-robotic voice
say Time to stretch -v Tessa
# Buffer time to finish whatever thought
sleep 20
# Sleep the screen
pmset displaysleepnow
@lenards
Copy link

lenards commented May 11, 2018

I'm not 100% sure, but I believe crontab -e is using whatever is set as $EDITOR for the shell session. This is usually vim, I think. If you preferred emacs, then what I've done is:

EDITOR=emacs crontab -e # or "nano", for simplicity

Some versions of Ubuntu may favor $SELECTED_EDITOR, which I believe is set by the selected-editor command (stored in ~/.selected_editor, or you could try using $VISUAL like shown here). I think the path shown would make me guess you're on MacOS though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment