Page 1 of 3 123 LastLast
Results 1 to 10 of 25

Thread: Does cron make up missed jobs?

  1. #1

    Default Does cron make up missed jobs?

    If my computer is off at the time of a scheduled job does cron run that job at the next boot or is it lost?

    Thanks, jon

  2. #2
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    26,297
    Blog Entries
    15

    Default Re: Does cron make up missed jobs?

    On Mon 13 Oct 2014 06:26:01 PM CDT, 6520302 wrote:


    If my computer is off at the time of a scheduled job does cron run that
    job at the next boot or is it lost?

    Thanks, jon


    Hi
    Unless you have specified a cron job time, they will run 15 minutes
    after boot.

    --
    Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
    openSUSE 13.1 (Bottle) (x86_64) GNOME 3.10.1 Kernel 3.11.10-21-desktop
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!


  3. #3

    Default Re: Does cron make up missed jobs?

    Quote Originally Posted by malcolmlewis View Post
    Hi
    Unless you have specified a cron job time, they will run 15 minutes
    after boot.
    Malcolm:

    Thank you. Yes, I have specified a time.

    I set up a job to run one time every week. So by specifying a time it will fail if the computer is not running?
    I guess I need to rethink my strategy.

    Rgds, jon

  4. #4
    Join Date
    Jun 2008
    Location
    Podunk
    Posts
    26,297
    Blog Entries
    15

    Default Re: Does cron make up missed jobs?

    On Mon 13 Oct 2014 07:36:01 PM CDT, 6520302 wrote:


    malcolmlewis;2669306 Wrote:
    > Hi
    > Unless you have specified a cron job time, they will run 15 minutes
    > after boot.


    Malcolm:

    Thank you. Yes, I have specified a time.

    I set up a job to run one time every week. So by specifying a time it
    will fail if the computer is not running?
    I guess I need to rethink my strategy.

    Rgds, jon


    Hi
    Use the @reboot?

    --
    Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
    openSUSE 13.1 (Bottle) (x86_64) GNOME 3.10.1 Kernel 3.11.10-21-desktop
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!


  5. #5

    Default Re: Does cron make up missed jobs?

    Quote Originally Posted by malcolmlewis View Post
    Hi
    Use the @reboot?

    --
    Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
    openSUSE 13.1 (Bottle) (x86_64) GNOME 3.10.1 Kernel 3.11.10-21-desktop
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!
    Thanks again. Not aware of that option and will research it.

    Jon

  6. #6

    Default Re: Does cron make up missed jobs?

    Quote Originally Posted by malcolmlewis View Post
    Hi
    Use the @reboot?

    --
    Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
    openSUSE 13.1 (Bottle) (x86_64) GNOME 3.10.1 Kernel 3.11.10-21-desktop
    If you find this post helpful and are logged into the web interface,
    please show your appreciation and click on the star below... Thanks!
    Hi Malcolm:

    @reboot doesn't sound like the right solution. It runs once after reboot. I reboot every day but only want to run the job on Friday.

    I'll just change the time of the job to make sure it runs late enough in the day that I'm unlikely to have a problem with the computer off.

    Appreciate your tips. The forum won't let me click the star because you were the last person I clicked on the star.

    Rgds, Jon

  7. #7
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: Does cron make up missed jobs?

    On 2014-10-13 21:25, malcolmlewis wrote:

    > On Mon 13 Oct 2014 06:26:01 PM CDT, 6520302 wrote:
    >
    >
    >> If my computer is off at the time of a scheduled job does cron run that
    >> job at the next boot or is it lost?


    > Hi
    > Unless you have specified a cron job time, they will run 15 minutes
    > after boot.


    Wait, those are not "normal" cron jobs. They are the jobs that you
    create in "/etc/cron.{hourly,daily,weekly,monthly}". They are a SuSE
    addition. Those will certainly run at the next opportunity, starting 15
    minutes after boot.


    But there is no way to specify a job to run on Fridays, and if failed,
    do when possible. For that you would use anacron instead, I guess.

    You can set the preferred time for daily jobs, though.

    Maybe the /usr/lib/cron/run-crons script could be improved for a
    preferred weekday.

    A way would be to put the job at an scheduled time, and then have a
    daily job to verify that last time it run was not more than 7 days ago,
    and if not, run it.

    --
    Cheers / Saludos,

    Carlos E. R.
    (from 13.1 x86_64 "Bottle" at Telcontar)

  8. #8

    Default Re: Does cron make up missed jobs?

    Quote Originally Posted by robin_listas View Post
    On 2014-10-13 21:25, malcolmlewis wrote:

    > On Mon 13 Oct 2014 06:26:01 PM CDT, 6520302 wrote:
    >
    >
    >> If my computer is off at the time of a scheduled job does cron run that
    >> job at the next boot or is it lost?


    > Hi
    > Unless you have specified a cron job time, they will run 15 minutes
    > after boot.


    Wait, those are not "normal" cron jobs. They are the jobs that you
    create in "/etc/cron.{hourly,daily,weekly,monthly}". They are a SuSE
    addition. Those will certainly run at the next opportunity, starting 15
    minutes after boot.


    But there is no way to specify a job to run on Fridays, and if failed,
    do when possible. For that you would use anacron instead, I guess.
    Ahhh, things are getting more complicated. I'll study these suggestions but for my simple purposes it seems that changing the job start time to a later time in the day, when my computer is usually running, would be the simplest way to insure I don't miss the job running.

    Jon

  9. #9
    Join Date
    Feb 2009
    Location
    Spain
    Posts
    25,547

    Default Re: Does cron make up missed jobs?

    On 2014-10-14 02:46, 6520302 wrote:

    > Ahhh, things are getting more complicated. I'll study these suggestions
    > but for my simple purposes it seems that changing the job start time to
    > a later time in the day, when my computer is usually running, would be
    > the simplest way to insure I don't miss the job running.


    There may be other simpler ways. You can just place the script in
    "/etc/cron.daily/", and have it check at the start if "today is Friday".
    If it is not, exit.

    Code:
    cer@Telcontar:~> date '+%A'
    Tuesday
    cer@Telcontar:~> date '+%u'
    2
    cer@Telcontar:~>
    It is trivial to use that in a script.


    Then on "/etc/sysconfig/cron" you define:

    Code:
    DAILY_TIME="22:10"
    So it will normally run every Friday at about 22:15, but if that time
    the computer is not running, it will run the next day, or perhaps 15
    minutes after boot; I'm unsure about daily jobs, but I think it is 15
    minutes, not next day.


    --
    Cheers / Saludos,

    Carlos E. R.
    (from 13.1 x86_64 "Bottle" at Telcontar)

  10. #10

    Default Re: Does cron make up missed jobs?

    Quote Originally Posted by robin_listas View Post
    On 2014-10-14 02:46, 6520302 wrote:

    > Ahhh, things are getting more complicated. I'll study these suggestions
    > but for my simple purposes it seems that changing the job start time to
    > a later time in the day, when my computer is usually running, would be
    > the simplest way to insure I don't miss the job running.


    There may be other simpler ways. You can just place the script in
    "/etc/cron.daily/", and have it check at the start if "today is Friday".
    If it is not, exit.
    robin:

    Thanks for the script info. I'm very green on scripts and syntax requirements. I think the code you posted looks good and I will give it a try.
    It looks a lot better than me just having a crontab for a time that I may or may not miss by being shutdown.

    Rgds, Jon

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •