Cron vs. Whenjobs vs. Goaljobs
cs at zip.com.au
Thu Dec 19 21:48:53 UTC 2013
On 18Dec2013 00:43, Jonathan Ryshpan <jonrysh at pacbell.net> wrote:
> * Frequently, I start the system, check my email and leave for
> breakfast; on these days, I'd like backup to start when I leave;
> I would invoke it by a shell script or whatever.
> * Other days, I stay on the system for a while; on these days I'd
> like cron to start the job whenever its algorithms think best.
> * I don't want to leave starting the job completely to a shell
> script run from a terminal, because I'd often forget to run it.
> If I can replace cron with at and get the desired result, I'll be happy.
Cron's algorithms are pretty simple; the do things when you tell them to:-(
If it were me I'd be doing this as follows:
I have a "flag" command:
I'd have a cron job for midnight that sets "BACKUP_DUE" to 1:
flag BACKUP_DUE 1
I'd have a core script that runs the backup with not checks of controls.
I presume you have such.
I'd have a wrapper script that takes a lock, checks BACKUP_DUE.
If false, do nothing, maybe report "backup not due".
If true, set it to false and dispatch the core script.
if mkdir /tmp/backup_lock
if flag BACKUP_DUE
flag BACKUP_DUE 0
core_backup_script 2>&1 | mail the-sysadmin &
Have a cron job that fires at 10am or whenever that is fallback for
your manual backup dispatch.
Just an idea,
Cameron Simpson <cs at zip.com.au>
I made this letter longer than usual because I lack the time to make it
shorter. - Pascal
More information about the users