Professional Web Applications Themes

cron v anacron - Ubuntu

Newbie here, running Ubuntu 5.10. I understand cron and crontab, but crontab only runs /etc/cron.hourly, anacrontab runs /etc/cron.daily, /etc/cron.weekly, and /etc/cron.monthly. At what time does anacron run /etc/cron.daily? Why doesn't anacron show up when I do ps aux | grep anacron?...

  1. #1

    Default cron v anacron

    Newbie here, running Ubuntu 5.10.

    I understand cron and crontab, but crontab only runs /etc/cron.hourly,
    anacrontab runs /etc/cron.daily, /etc/cron.weekly, and /etc/cron.monthly.

    At what time does anacron run /etc/cron.daily?

    Why doesn't anacron show up when I do ps aux | grep anacron?
    Dean DeBruin Guest

  2. #2

    Default Re: cron v anacron

    Dean DeBruin wrote:
    > Newbie here, running Ubuntu 5.10.
    >
    > I understand cron and crontab, but crontab only runs /etc/cron.hourly,
    > anacrontab runs /etc/cron.daily, /etc/cron.weekly, and /etc/cron.monthly.
    >
    > At what time does anacron run /etc/cron.daily?
    >
    > Why doesn't anacron show up when I do ps aux | grep anacron?
    Does anacron only run at startup? That would explain some things, but
    then there are problems with crontab...
    Dean DeBruin Guest

  3. #3

    Default Re: cron v anacron

    On 2006-02-28, Dean DeBruin <deandbnospam.com> wrote:
    > Newbie here, running Ubuntu 5.10.
    >
    > I understand cron and crontab, but crontab only runs /etc/cron.hourly,
    > anacrontab runs /etc/cron.daily, /etc/cron.weekly, and /etc/cron.monthly.
    >
    > At what time does anacron run /etc/cron.daily?
    >
    > Why doesn't anacron show up when I do ps aux | grep anacron?
    You can use cron to run things daily, weekly and monthly.

    type
    $ crontab -e
    to edit your crontab file.

    This is a separate thing to the scripts in /etc/cron.* and is more
    adaptable to your personal needs, I find.

    * * * * * command to be executed
    - - - - -
    | | | | |
    | | | | +----- day of week (0 - 6) (Sunday=0)
    | | | +------- month (1 - 12)
    | | +--------- day of month (1 - 31)
    | +----------- hour (0 - 23)
    +------------- min (0 - 59)

    --
    -Toby, who...
    Add the word afiduluminag to the subject
    field to cirvent my email filters.
    Ignore any mail delivery error.
    Toby Newman Guest

  4. #4

    Default Re: cron v anacron

    Toby Newman wrote:
    > On 2006-02-28, Dean DeBruin <deandbnospam.com> wrote:
    >
    >>Newbie here, running Ubuntu 5.10.
    >>
    >>I understand cron and crontab, but crontab only runs /etc/cron.hourly,
    >>anacrontab runs /etc/cron.daily, /etc/cron.weekly, and /etc/cron.monthly.
    >>
    >>At what time does anacron run /etc/cron.daily?
    >>
    >>Why doesn't anacron show up when I do ps aux | grep anacron?
    >
    >
    > You can use cron to run things daily, weekly and monthly.
    >
    > type
    > $ crontab -e
    > to edit your crontab file.
    >
    > This is a separate thing to the scripts in /etc/cron.* and is more
    > adaptable to your personal needs, I find.
    >
    > * * * * * command to be executed
    > - - - - -
    > | | | | |
    > | | | | +----- day of week (0 - 6) (Sunday=0)
    > | | | +------- month (1 - 12)
    > | | +--------- day of month (1 - 31)
    > | +----------- hour (0 - 23)
    > +------------- min (0 - 59)
    >
    Thank you, I'll look into that.

    I was trying to run a system-wide daily backup script. I put a link to
    it in /etc/cron.daily but it didn't run so I tried to figure out
    /etc/crontab.

    My /etc/crontab has the following lines:
    > 17 * * * * root run-parts --report /etc/cron.hourly
    > 25 6 * * * root test -x /usr/sbin/anacron || run-parts --report /etc/cron.daily
    > 47 6 * * 7 root test -x /usr/sbin/anacron || run-parts --report /etc/cron.weekly
    > 52 6 1 * * root test -x /usr/sbin/anacron || run-parts --report /etc/cron.monthly
    As far as I can figure out (by reading man pages and by testing)
    run-parts runs hourly, but for the daily, weekly, and monthly lines it
    will only run if /usr/sbin/anacron does NOT exist! Am I missing something?

    /usr/sbin/anacron DOES exist so I removed "test -x /usr/sbin/anacron ||"
    from the daily, weekly, and monthly lines and now it seems to work.
    Dean DeBruin Guest

  5. #5

    Default Re: cron v anacron

    On 2006-02-28, Dean DeBruin <deandbnospam.com> wrote:
    > Toby Newman wrote:
    >> On 2006-02-28, Dean DeBruin <deandbnospam.com> wrote:
    >>
    >>>Newbie here, running Ubuntu 5.10.
    >>>
    >>>I understand cron and crontab, but crontab only runs /etc/cron.hourly,
    >>>anacrontab runs /etc/cron.daily, /etc/cron.weekly, and /etc/cron.monthly.
    >>>
    >>>At what time does anacron run /etc/cron.daily?
    >>>
    >>>Why doesn't anacron show up when I do ps aux | grep anacron?
    >>
    >>
    >> You can use cron to run things daily, weekly and monthly.
    >>
    >> type
    >> $ crontab -e
    >> to edit your crontab file.
    >>
    >> This is a separate thing to the scripts in /etc/cron.* and is more
    >> adaptable to your personal needs, I find.
    >>
    >> * * * * * command to be executed
    >> - - - - -
    >> | | | | |
    >> | | | | +----- day of week (0 - 6) (Sunday=0)
    >> | | | +------- month (1 - 12)
    >> | | +--------- day of month (1 - 31)
    >> | +----------- hour (0 - 23)
    >> +------------- min (0 - 59)
    >>
    >
    > Thank you, I'll look into that.
    >
    > I was trying to run a system-wide daily backup script. I put a link to
    > it in /etc/cron.daily but it didn't run so I tried to figure out
    > /etc/crontab.
    >
    Another way would be to type
    $ crontab -e
    to edit your user's crontab and add the following in order to run a
    script at 4am each day:

    shell=/bin/sh
    MAILTO=yourEmailAddressinvalid.com.invalid
    0 4 * * * /path/to/script --AnySwitches

    --
    -Toby, who...
    Add the word afiduluminag to the subject
    field to cirvent my email filters.
    Ignore any mail delivery error.
    Toby Newman Guest

  6. #6

    Default Re: cron v anacron

    * Toby Newman wrote in alt.os.linux.ubuntu:
    > Another way would be to type
    > $ crontab -e
    > to edit your user's crontab and add the following in order to run a
    > script at 4am each day:
    >
    > shell=/bin/sh
    > MAILTO=yourEmailAddressinvalid.com.invalid
    > 0 4 * * * /path/to/script --AnySwitches
    Wont that only run it on Sunday's 4?

    --
    David
    SINNER Guest

  7. #7

    Default Re: cron v anacron

    * Toby Newman wrote in alt.os.linux.ubuntu:
    > Another way would be to type
    > $ crontab -e
    > to edit your user's crontab and add the following in order to run a
    > script at 4am each day:
    >
    > shell=/bin/sh
    > MAILTO=yourEmailAddressinvalid.com.invalid
    > 0 4 * * * /path/to/script --AnySwitches
    never mind...DOH!

    --
    David
    SINNER Guest

  8. #8

    Default Re: cron v anacron

    Dean DeBruin schrieb:
    > Toby Newman wrote:
    [...]
    > My /etc/crontab has the following lines:
    >
    >> 17 * * * * root run-parts --report /etc/cron.hourly
    >> 25 6 * * * root test -x /usr/sbin/anacron || run-parts --report
    >> /etc/cron.daily
    >> 47 6 * * 7 root test -x /usr/sbin/anacron || run-parts --report
    >> /etc/cron.weekly
    >> 52 6 1 * * root test -x /usr/sbin/anacron || run-parts --report
    >> /etc/cron.monthly
    >
    >
    > As far as I can figure out (by reading man pages and by testing)
    > run-parts runs hourly, but for the daily, weekly, and monthly lines it
    > will only run if /usr/sbin/anacron does NOT exist! Am I missing something?
    >
    > /usr/sbin/anacron DOES exist so I removed "test -x /usr/sbin/anacron ||"
    > from the daily, weekly, and monthly lines and now it seems to work.
    -x means:
    check for the existence AND check wether it is executable

    so, if /usr/sbin/anacron exists and is executable it will be executed
    otherwise run-parts --report will be executed.

    Torsten
    Torsten Flammiger Guest

  9. #9

    Default Re: cron v anacron

    Dean DeBruin <deandbnospam.com> wrote:
    > Newbie here, running Ubuntu 5.10.
    >
    > I understand cron and crontab, but crontab only runs /etc/cron.hourly,
    > anacrontab runs /etc/cron.daily, /etc/cron.weekly, and /etc/cron.monthly.
    anacron "cannot currently be used to schedule commands at intervals smaller
    than days" as the README.gz says
    > At what time does anacron run /etc/cron.daily?
    >
    > Why doesn't anacron show up when I do ps aux | grep anacron?
    anacron runs at startup and is executed each morning by cron (see
    /etc/crontab). It's not a daemon so it doesn't show up in ps after it
    has finished today's work.


    Florian
    --
    Das ist ja das positive am usenet: man erfährt oft Dinge, nach denen
    gar nicht gefragt wurde.
    [Konrad Wilhelm in <lsght1hho14bbe7in8q9currhtc7vuqfru4ax.com>]
    Florian Diesch Guest

  10. #10

    Default Re: cron v anacron

    Torsten Flammiger wrote:
    > Dean DeBruin schrieb:
    >
    >>Toby Newman wrote:
    >
    >
    > [...]
    >
    >
    >>My /etc/crontab has the following lines:
    >>
    >>
    >>>17 * * * * root run-parts --report /etc/cron.hourly
    >>>25 6 * * * root test -x /usr/sbin/anacron || run-parts --report
    >>>/etc/cron.daily
    >>>47 6 * * 7 root test -x /usr/sbin/anacron || run-parts --report
    >>>/etc/cron.weekly
    >>>52 6 1 * * root test -x /usr/sbin/anacron || run-parts --report
    >>>/etc/cron.monthly
    >>
    >>
    >>As far as I can figure out (by reading man pages and by testing)
    >>run-parts runs hourly, but for the daily, weekly, and monthly lines it
    >>will only run if /usr/sbin/anacron does NOT exist! Am I missing something?
    >>
    >>/usr/sbin/anacron DOES exist so I removed "test -x /usr/sbin/anacron ||"
    >>from the daily, weekly, and monthly lines and now it seems to work.
    >
    >
    > -x means:
    > check for the existence AND check wether it is executable
    >
    > so, if /usr/sbin/anacron exists and is executable it will be executed
    > otherwise run-parts --report will be executed.
    >
    > Torsten
    As far as I can tell, "test -x file"only checks the existence of the
    file and whether it is executable. It does not execute the file. The
    following experiment seems to support that idea.

    deanubuntu:~$ ls -l ./hello
    -rwxr-xr-x 1 dean dean 31 2006-02-28 23:10 ./hello
    deanubuntu:~$ ./hello
    hello, world
    deanubuntu:~$ test -x ./hello
    deanubuntu:~$ test -x ./hello || echo goodbye
    deanubuntu:~$

    The above experiment also shows that cron would not execute the daily,
    weekly, and monthly lines in /etc/crontab.
    Dean DeBruin Guest

  11. #11

    Default Re: cron v anacron

    Florian Diesch wrote:
    > Dean DeBruin <deandbnospam.com> wrote:
    >
    >>Newbie here, running Ubuntu 5.10.
    >>
    >>I understand cron and crontab, but crontab only runs /etc/cron.hourly,
    >>anacrontab runs /etc/cron.daily, /etc/cron.weekly, and /etc/cron.monthly.
    >
    >
    > anacron "cannot currently be used to schedule commands at intervals smaller
    > than days" as the README.gz says
    >
    >
    >>At what time does anacron run /etc/cron.daily?
    >>
    >>Why doesn't anacron show up when I do ps aux | grep anacron?
    >
    >
    > anacron runs at startup and is executed each morning by cron (see
    > /etc/crontab). It's not a daemon so it doesn't show up in ps after it
    > has finished today's work.
    Yes, I finally figured out that anacron runs at startup and then exits.
    It is not a daemon. However, it is not executed each morning by cron,
    nor should it be.

    Anacron is intended to run at startup to catch those jobs missed by cron
    while the computer is shut down. If cron is running, there is no need
    for it to run anacron. I contend that the "test -x /usr/sbin/anacron
    ||" does not belong in /etc/crontab.

    Dean
    Dean DeBruin Guest

  12. #12

    Default Re: cron v anacron

    Dean DeBruin schrieb:
    > Torsten Flammiger wrote:
    >
    >> Dean DeBruin schrieb:
    >>
    >>> Toby Newman wrote:
    >>
    >>
    >>
    >> [...]
    >>
    >>
    >>> My /etc/crontab has the following lines:
    >>>
    >>>
    >>>> 17 * * * * root run-parts --report /etc/cron.hourly
    >>>> 25 6 * * * root test -x /usr/sbin/anacron || run-parts --report
    >>>> /etc/cron.daily
    >>>> 47 6 * * 7 root test -x /usr/sbin/anacron || run-parts --report
    >>>> /etc/cron.weekly
    >>>> 52 6 1 * * root test -x /usr/sbin/anacron || run-parts --report
    >>>> /etc/cron.monthly
    >>>
    >>>
    >>>
    >>> As far as I can figure out (by reading man pages and by testing)
    >>> run-parts runs hourly, but for the daily, weekly, and monthly lines it
    >>> will only run if /usr/sbin/anacron does NOT exist! Am I missing
    >>> something?
    >>>
    >>> /usr/sbin/anacron DOES exist so I removed "test -x /usr/sbin/anacron ||"
    >>> from the daily, weekly, and monthly lines and now it seems to work.
    >>
    >>
    >>
    >> -x means:
    >> check for the existence AND check wether it is executable
    >>
    >> so, if /usr/sbin/anacron exists and is executable it will be executed
    >> otherwise run-parts --report will be executed.
    >>
    >> Torsten
    >
    >
    > As far as I can tell, "test -x file"only checks the existence of the
    > file and whether it is executable. It does not execute the file. The
    you are right - my mistake.. beat me :-)
    Torsten Flammiger Guest

  13. #13

    Default Re: cron v anacron

    Dean DeBruin wrote:
    > Newbie here, running Ubuntu 5.10.
    >
    > I understand cron and crontab, but crontab only runs /etc/cron.hourly,
    > anacrontab runs /etc/cron.daily, /etc/cron.weekly, and /etc/cron.monthly.
    >
    > At what time does anacron run /etc/cron.daily?
    >
    > Why doesn't anacron show up when I do ps aux | grep anacron?
    For anyone following this thread, cron and anacron are working properly.
    See the bug report: [url]https://launchpad.net/malone/bugs/35617[/url]

    Dean DeBruin Guest

Similar Threads

  1. cron job
    By cljlk in forum Linux / Unix Administration
    Replies: 1
    Last Post: April 2nd, 06:50 PM
  2. rsh and cron
    By cljlk in forum Linux / Unix Administration
    Replies: 2
    Last Post: November 14th, 03:20 PM
  3. cron
    By Richard Lynch in forum PHP Development
    Replies: 0
    Last Post: August 15th, 05:14 PM
  4. Cron Not Restarted
    By Adam Williams in forum AIX
    Replies: 1
    Last Post: August 7th, 04:25 PM
  5. CRON: bad user
    By friesje306 in forum Sun Solaris
    Replies: 0
    Last Post: July 31st, 09:52 AM

Bookmarks

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139