Skip to content

Instantly share code, notes, and snippets.

@ahhh
Created November 2, 2015 09:12
Show Gist options
  • Save ahhh/991358c5b1c7cf760bf1 to your computer and use it in GitHub Desktop.
Save ahhh/991358c5b1c7cf760bf1 to your computer and use it in GitHub Desktop.
one liner to programmatically add commands to a crontab file, with the ability to deduplicate the command or time (using grep -v)
cc=”echo 'YOUR COMMANDS GO HERE'”;cj=”35 8 * * * $cc”; ( sudo crontab -l | grep -v "$cc" ; echo "$cj" ) | sudo crontab -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment