On 18Dec2013 00:43, Jonathan Ryshpan <jonr...@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:

  https://bitbucket.org/cameron_simpson/css/src/tip/bin/flag

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.
Release lock.

Untested hack:

  if mkdir /tmp/backup_lock
  then
    if flag BACKUP_DUE
    then
      flag BACKUP_DUE 0
      core_backup_script 2>&1 | mail the-sysadmin &
    fi
    rmdir /tmp/backup_lock
  fi

Have a cron job that fires at 10am or whenever that is fallback for
your manual backup dispatch.

Just an idea,
-- 
Cameron Simpson <c...@zip.com.au>

I made this letter longer than usual because I lack the time to make it
shorter.        - Pascal
-- 
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines
Have a question? Ask away: http://ask.fedoraproject.org

Reply via email to