cron daily jobs all run together - Setup

This is a discussion on cron daily jobs all run together - Setup ; Hi I have a number of scripts running as cron daily jobs on my FC6 which do tasks such as backup and system update. They all run ok but the problem is each starts sometime between 0400 and 0430 which ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: cron daily jobs all run together

  1. cron daily jobs all run together

    Hi

    I have a number of scripts running as cron daily jobs on my FC6 which
    do tasks such as backup and system update. They all run ok but the
    problem is each starts sometime between 0400 and 0430 which puts a lot
    of strain on the cpu. Does anyone know how to influence the activation
    time considering the fact that my machine does very little within the
    other 23 hours?

    Regards


  2. Re: cron daily jobs all run together

    On 2007-05-13, na01 wrote:
    >
    > I have a number of scripts running as cron daily jobs on my FC6 which
    > do tasks such as backup and system update. They all run ok but the
    > problem is each starts sometime between 0400 and 0430 which puts a lot
    > of strain on the cpu. Does anyone know how to influence the activation
    > time considering the fact that my machine does very little within the
    > other 23 hours?


    Put entrries in /etc/crontab instead of putting the scripts into
    /etc/cron.daily.

    --keith

    --
    kkeller-usenet@wombat.san-francisco.ca.us
    (try just my userid to email me)
    AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
    see X- headers for PGP signature information


  3. Re: cron daily jobs all run together

    na01 wrote:
    > Hi
    >
    > I have a number of scripts running as cron daily jobs on my FC6 which
    > do tasks such as backup and system update. They all run ok but the
    > problem is each starts sometime between 0400 and 0430 which puts a lot
    > of strain on the cpu. Does anyone know how to influence the activation
    > time considering the fact that my machine does very little within the
    > other 23 hours?


    Scripts in /etc/cron.daily run sequentially. Unless you've written your
    scripts to detach processes, they won't run things simultaneously.
    Conversely, if things are running simultaneously, it's because you wrote
    them that way.

  4. Re: cron daily jobs all run together

    na01 wrote:
    > Hi
    >
    > I have a number of scripts running as cron daily jobs on my FC6 which
    > do tasks such as backup and system update. They all run ok but the
    > problem is each starts sometime between 0400 and 0430 which puts a lot
    > of strain on the cpu. Does anyone know how to influence the activation
    > time considering the fact that my machine does very little within the
    > other 23 hours?
    >

    In Red Hat systems, cron is driven mainly by the file /etc/crontab
    Lines in /etc/crontab are run at the specified time and date. For example,
    the line for stuff to be run daily on my machine is as follows:

    #M H D m d user program arguments
    04 1 * * 1-6 root run-parts /etc/cron.daily

    This means that at 4 minutes after 1AM local time on Monday through
    Saturday, program run-parts runs with argument /etc/cron.daily.

    Now run-parts is a little program (shell script) that runs each program in
    the specified directory (in this case, /etc/cron.daily) one after the other
    in "alphabetical" order.

    So they run one at a time unless they are specifically setup to run in
    parallel (which you would normally never do).

    If you use this setup, you would never get into trouble unless you setup
    some other entry in /etc/crontab to start at nearly the same time. Perhaps
    the hourly entry. Mine is like this:

    01 * * * * root run-parts /etc/cron.hourly

    Now it turns out that there are very few entries in /etc/cron.hourly (namely
    none), but if there were any time-consuming ones, so that the total were
    over 3 minutes, I would have the daily script start a little later.

    --
    .~. Jean-David Beyer Registered Linux User 85642.
    /V\ PGP-Key: 9A2FC99A Registered Machine 241939.
    /( )\ Shrewsbury, New Jersey http://counter.li.org
    ^^-^^ 06:50:01 up 85 days, 18:19, 3 users, load average: 4.56, 4.27, 4.09

  5. Re: cron daily jobs all run together

    I demand that Jean-David Beyer may or may not have written...

    > na01 wrote:
    >> I have a number of scripts running as cron daily jobs on my FC6 which do
    >> tasks such as backup and system update. They all run ok but the problem
    >> is each starts sometime between 0400 and 0430 which puts a lot of strain
    >> on the cpu. Does anyone know how to influence the activation time
    >> considering the fact that my machine does very little within the other 23
    >> hours?


    > In Red Hat systems, cron is driven mainly by the file /etc/crontab Lines in
    > /etc/crontab are run at the specified time and date. For example, the line
    > for stuff to be run daily on my machine is as follows:
    >
    > #M H D m d user program arguments
    > 04 1 * * 1-6 root run-parts /etc/cron.daily


    I'd leave /etc/crontab alone and add files to /etc/cron.d; the format is the
    same. (Of course, if RH systems don't have /etc/cron.d...)

    [snip]
    --
    | Darren Salt | linux or ds at | nr. Ashington, | Toon
    | RISC OS, Linux | youmustbejoking,demon,co,uk | Northumberland | Army
    | + Buy local produce. Try to walk or cycle. TRANSPORT CAUSES GLOBAL WARMING.

    He who hates vices hates mankind.

  6. Re: cron daily jobs all run together

    Darren Salt wrote:
    > I demand that Jean-David Beyer may or may not have written...
    >
    >> na01 wrote:
    >>> I have a number of scripts running as cron daily jobs on my FC6 which do
    >>> tasks such as backup and system update. They all run ok but the problem
    >>> is each starts sometime between 0400 and 0430 which puts a lot of strain
    >>> on the cpu. Does anyone know how to influence the activation time
    >>> considering the fact that my machine does very little within the other 23
    >>> hours?

    >
    >> In Red Hat systems, cron is driven mainly by the file /etc/crontab Lines in
    >> /etc/crontab are run at the specified time and date. For example, the line
    >> for stuff to be run daily on my machine is as follows:
    >>
    >> #M H D m d user program arguments
    >> 04 1 * * 1-6 root run-parts /etc/cron.daily

    >
    > I'd leave /etc/crontab alone and add files to /etc/cron.d; the format is the
    > same. (Of course, if RH systems don't have /etc/cron.d...)
    >

    They do, but mine contains only:

    cron.d:
    total 8
    -rw-r--r-- 1 root root 188 Nov 15 2005 sysstat

    $ cat cron.d/sysstat
    # run system activity accounting tool every 10 minutes
    */10 * * * * root /usr/lib/sa/sa1 1 1
    # generate a daily summary of process accounting at 23:53
    53 23 * * * root /usr/lib/sa/sa2 -A

    I like to keep my regular stuff together in /etc/cron.hourly, .daily,
    ..weekly, and .monthly in each of which run-parts runs one after the other as
    fast as it can.

    --
    .~. Jean-David Beyer Registered Linux User 85642.
    /V\ PGP-Key: 9A2FC99A Registered Machine 241939.
    /( )\ Shrewsbury, New Jersey http://counter.li.org
    ^^-^^ 08:35:01 up 86 days, 20:04, 3 users, load average: 4.37, 4.43, 4.26

+ Reply to Thread