Last active
December 25, 2015 01:59
-
-
Save unfo/6899859 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Safer way to edit cron so you don't mistakenly REMOVE the entire crontab | |
# with crontab -r when you meant to type crontab -e | |
# Also provides useful diff of your changes | |
ts=$(date +%s) | |
before=/tmp/`whoami`_crontab_before_$ts | |
after=/tmp/`whoami`_crontab_after_$ts | |
crontab -l > $before | |
crontab -e | |
crontab -l > $after | |
diff $before $after |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment