Last active
December 23, 2015 19:32
-
-
Save StevenMMortimer/8e8c6954b8e4846b3d1a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# BELOW IS THE FORMAT OF A CRONTAB THAT WILL: | |
# EXECUTE AN R SCRIPT COMMAND, SEND STDERR AND STDOUT TO A TEMP FILE | |
# WHILE ONLY SENDING THE CONTENTS OF THE TEMP FILE TO SCREEN, WHICH TRIGGERS AN EMAIL, | |
# IF THE EXIT CODE OF THE RSCRIPT WAS NON-ZERO | |
# ESSENTIALLY CONFIGURATION LOGS EVERYTHING WHILE EMAILING ONLY ON ERROR | |
# | |
# To install a cron from this file use: | |
# dos2unix < mycrontab.txt | crontab - | |
# NOTE: mycrontab.txt must have everything needed since it completely wipes the existing crontab | |
# | |
# This means run every minute | |
# * * * * * command myscript | |
# | |
* * * * * Rscript myrscript.R > temp.log 2>&1 || cat temp.log && cat temp.log >> reallog.log && rm temp.log | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment