[PATCH] Basic fcron-like functionality
by Tim Landscheidt
Hi,
the attached patch provides some initial fcron-like func-
tionality. Given a crontab of:
| %daily */7 * echo daily
| %weekly */23 * echo weekly
| %hourly */3 echo hourly
it will run:
1. "echo daily" once per calendar day, on the first possi-
bility of minute % 7 == 0,
2. "echo weekly" once per calendar week (Monday to Sunday),
on the first possibility of minute % 23 == 0, and
3. "echo hourly" once per hour, on the first possibility of
minute % 3 == 0.
Periods are reset when crond is started. I haven't actually
tested the daily/weekly bits thoroughly as I didn't want to
wait :-). I didn't get the indentation quite right as TABs
are pure evil.
I'd like to push this to fedorahosted.org in a branch to
ease collaboration and thus have applied for the gitcronie
group.
In further development, besides writing documentation,
I'll add a state file in /var/lib that saves the times of
last execution over a reset. For that I'd like to survey
what in users' views makes a job "unique". I. e., should
the time of last execution of "%daily */7 * echo daily" be
based besides the user name on the command ("echo daily"),
the command and flattened schedule ("echo daily",
"0:00/0:07/0:14/0:21/etc."), the literal crontab line or
something else? This is not only interesting for restarts,
but also for user crontab reloads.
Tim
11 years, 7 months
crond to collect zombie child process
by cheng renquan
on my system with cronie-1.4.8, I noticed crond had spawned child processes
but when child exited, it left zombie there:
I think cronie should add a child dead signal and call wait there,
should be easy to implement
2086 ? Ss 0:00 /usr/sbin/crond
3499 ? S 0:00 \_ /USR/SBIN/CROND
3500 ? Zs 0:00 \_ [run-parts] <defunct>
$ ps fj 2086 3499 3500
PPID PID PGID SID TTY TPGID STAT UID TIME COMMAND
1 2086 2086 2086 ? -1 Ss 0 0:00 /usr/sbin/crond
2086 3499 2086 2086 ? -1 S 0 0:00 \_ /USR/SBIN/CROND
3499 3500 3500 3500 ? -1 Zs 0 0:00 \_
[run-parts] <defunct>
$ ps fu 2086 3499 3500
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 2086 0.0 0.0 11368 472 ? Ss Jun22 0:00 /usr/sbin/crond
root 3499 0.0 0.0 34700 1244 ? S 23:01 0:00 \_
/USR/SBIN/CROND
root 3500 0.0 0.0 0 0 ? Zs 23:01 0:00
\_ [run-parts] <defunct>
$ pacman -Qo /usr/sbin/crond
/usr/sbin/crond is owned by cronie 1.4.8-1
$ pacman -Qi cronie
Name : cronie
Version : 1.4.8-1
URL : https://fedorahosted.org/cronie/
Licenses : custom:BSD
Groups : base
Provides : cron
Depends On : pam bash run-parts
Optional Deps : smtp-server: sending cron job output via email
Required By : logrotate
Conflicts With : cron
Replaces : None
Installed Size : 188.00 KiB
Packager : Gaetan Bisson <bisson(a)archlinux.org>
Architecture : x86_64
Build Date : Tue 28 Jun 2011 08:43:10 AM PDT
Install Date : Sat 19 Nov 2011 12:24:55 AM PST
Install Reason : Explicitly installed
Install Script : No
Description : Daemon that runs specified programs at scheduled
times and related tools
11 years, 10 months