Does anyone have much experience with cron jobs on laptops or netbooks, as in does setting MAX_NOT_RUN=1 in /etc/sysconfig/cron actually work well or is it better to just use anacron?
On 2011-06-16 11:36, tk83 wrote:
>
> Does anyone have much experience with cron jobs on laptops or netbooks,
> as in does setting MAX_NOT_RUN=1 in /etc/sysconfig/cron actually work
> well or is it better to just use anacron?
The daily/weekly/monthly jobs will eventually work. You can not say exactly
when, but they will run.
Cron jobs, though, might not ever run.
There is a difference.
–
Cheers / Saludos,
Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)
So anacron is still a good idea then I guess. Does it require any configuration or can I just install the package and it works?
On 2011-06-16 13:36, tk83 wrote:
>
> So anacron is still a good idea then I guess
Depends on your needs.
–
Cheers / Saludos,
Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)
Found this discussion last week, when wondering about the same issue, but I did not find the conclusions too convincing.
Now I have tried it myself for a week, so I can answer.
If you just want to make sure that a job runs once a day, regardless when you turn on the machine there is no need for anacron. Just add your “job” into /etc/cron.daily/ directory
This is not really a cron feature, but an OpenSUSE feature, if I got it correctly. Behaviour will be determined by /etc/sysconfig/cron. Default values (at least in my 11.3) are fine, no need to change anything.
## Type: string
## Default: ""
#
# At which time cron.daily should start. Default is 15 minutes after booting
# the system. Example setting would be "14:00".
# Due to the fact that cron script runs only every 15 minutes,
# it will only run on xx:00, xx:15, xx:30, xx:45, not at the accurate time
# you set.
DAILY_TIME=""
So the “jobs” from the /etc/cron.daily directory (they are not really cron jobs) run at the full quarter that follows 15 minutes after booting.
## Type: integer
## Default: 5
#
# Maximum days not running when using a fixed time set in DAILY_TIME.
# 0 to skip this. This is for users who will power off their system.
#
# There is a fixed max. of 14 days set, if you want to override this
# change MAX_NOT_RUN_FORCE in /usr/lib/cron/run-crons
MAX_NOT_RUN="5"
This parameter is not relevant if DAILY_TIME has not been specified.
Jobs would probably not be run reliably if your machine always runs for less than 30 minutes a day. Not a problem for me.
I only need daily jobs at the moment, so I haven’t thought about other frequencies would work.
Actually when you want to see how it works, you can change one parameter:
## Type: yesno
## Default: no
#
# generate syslog message for all scripts in
# cron.{hourly,daily,weekly,monthly}
# even if they haven't returned an error? (yes/no)
#
SYSLOG_ON_NO_ERROR="yes"
(Days) Later you can do a
sudo grep cron /var/log/messages
to see when your “jobs” where executed.
On 2011-07-10 16:36, geuder wrote:
> Now I have tried it myself for a week, so I can answer.
Yes, that is how it works
–
Cheers / Saludos,
Carlos E. R.
(from 11.4 x86_64 “Celadon” at Telcontar)