[systemd-devel] [PATCH] timer: allow user to control activation time of cron-like timers

Reindl Harald h.reindl at thelounge.net
Sun May 11 09:33:20 PDT 2014



Am 11.05.2014 18:30, schrieb Alex B:
> 2014-05-11 20:09 GMT+04:00 Dave Reisner <d at falconindy.com>:
>> On Sun, May 11, 2014 at 07:53:55PM +0400, Alexander Bashmakov wrote:
>>> Issue was rised in this thread:
>>> https://mailman.archlinux.org/pipermail/arch-general/2014-May/036162.html
>>>
>>> Disclaimer:
>>> I almost have no expereince in C.
>>> So this patch can contain some silly mistakes. But it 'works for me'.
>>> Please consider it as RFC.
>>>
>>> -8<-------
>>> Cron-like timers are useful for maintenance tasks
>>> and already used in some distros by default.
>>> But midnight is not best time for this.
>>> Just add a new option allowing user to specify
>>> activation time (and date) for such timers globally.
>>
>> "daily" is just syntactic sugar for "*-*-* 00:00:00". If you don't want
>> to run at midnight, modify the normalized form to run at the time you
>> want.
>>
> 
> It's ok for one timer, but not for the set of them.
> In general I'm want to schedule all maintenance tasks to 5 a.m.
> or lunch break and forget about them.
> This applies both for distro provided timers an my own

that's why anacron don't fire up them at the same time
given that you can have on a host 10,20,100 guests *that* below is the solution
______________________________________________________

# /etc/anacrontab: configuration file for anacron
# See anacron(8) and anacrontab(5) for details.

SHELL=/usr/bin/bash
PATH=/usr/bin:/usr/sbin
LANG=en_GB.UTF-8
MAILTO=root

# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=5

# the jobs will be started during the following hours only
START_HOURS_RANGE=3-9

#period in days   delay in minutes   job-identifier   command
1                 5                  cron.daily       nice -n 19 run-parts /etc/cron.daily
7                 25                 cron.weekly      nice -n 19 run-parts /etc/cron.weekly
@monthly          35                 cron.monthly     nice -n 19 run-parts /etc/cron.monthly

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 246 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20140511/8db7a47b/attachment.sig>


More information about the systemd-devel mailing list