Hot answers tagged cron
Keep in mind that a script running in cron does not have the same environment as a script running in shell. The cron daemon starts a subshell from your HOME directory. The cron daemon supplies a default environment for every shell, defining HOME, LOGNAME, SHELL (=/usr/bin/sh), and PATH (=/usr/bin). Do not depend on environment variables. This includes ...
Depending on your flavor of cron, it may not love the / notation. Rather than trying to make it super-compact, just tell it what you want it to do in a more acceptable to most/all versions of cron fashion. Might have the advantage of being more obvious to more humans, too. It's a simple system - you really shouldn't need a "tool" to create a crontab beyond ...
Short: powering off the machine stops any job now. Unison's page states that Unison is resilient to failure. It is careful to leave the replicas and its own private structures in a sensible state at all times, even in case of abnormal termination or communication failures.
One problem with your script is that it will run every minute (because of the first "*"). Since you have 6 hours, it's pretty hard to run the cron only 4 times. One solution could be: 0 6,7,8,9 * * * /path/command
cron already sends mails, if a compatible /usr/sbin/sendmail is installed (e.g. msmtp, ssmtp, Postfix, OpenSMTPD…). See also: What is the "You have new mail" message in Linux/UNIX? chronic from moreutils can handle the "only on success" part: chronic timeout 1h /app/longprocess.sh
sometask||echo Something Went Wrong! | mail -s E-MailSubject email@example.com The || will only run what is on the right, if the command on the left returns a non-zero error code. This functionality is built into the shell (I'm seeing this question has the "bash" tag), so no extra external program is needed to support that functionality. The "mail" ...
Solved First, this was achieved using sudo crontab -e though it might also work using crontab -e from the logged in user as well -- I just don't know if there would be a permission issue. Second, the cron entries needed to be modified to include a leading "sh" as shown below: 0 8 * * 1-5 sh /config/scripts/set-blocking-hosts.sh 0 19 * * 1-5 sh ...
As Thomas Dickey already indicated, and from my own experience, Unison handles unexpected terminations, connection loss, etc., gracefully. Moreover, I've noticed that on the next synchronization, it will even pick up where it left off last time, saving you at least some bandwidth and/or time :)
Only top voted, non community-wiki answers of a minimum length are eligible