Skip to content

Instantly share code, notes, and snippets.

@evancz evancz/cron.md
Last active Nov 7, 2019

Embed
What would you like to do?
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

This comment has been minimized.

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
You can’t perform that action at this time.