Page MenuHomeFreeBSD

cron: Implement -s command option
Needs ReviewPublic

Authored by otis on Jul 11 2021, 2:21 PM.

Details

Reviewers
None
Group Reviewers
manpages
Summary

Based on an idea suggested by Job Snijders <job@sobornost.net>,
a -s command option has been implemented, with great deal of inspiration
from OpenBSD.

When used, it allows only a single instance of given command
to run at once, allowing the next one to run only after the previous
one finishes.

For this to happen, job queue has been reworked to use queue instead
of a simple linked list.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint OK
Unit
No Unit Test Coverage
Build Status
Buildable 40504
Build 37393: arc lint + arc unit

Event Timeline

otis requested review of this revision.Jul 11 2021, 2:21 PM

The man page part looks good, but I am a little bit confused, on my FreeBSD systems I see

root 66156 0.0 0.0 12800 1680 - Is 7Jul21 0:04.38 /usr/sbin/cron -s

when executing 'ps axuw'. So it seems, that some kind of a '-s' option is already implemented.

In D31146#701876, @gbe wrote:

The man page part looks good, but I am a little bit confused, on my FreeBSD systems I see

root 66156 0.0 0.0 12800 1680 - Is 7Jul21 0:04.38 /usr/sbin/cron -s

when executing 'ps axuw'. So it seems, that some kind of a '-s' option is already implemented.

That's a command option for cron, the change has to do with crontab entries, see crontab.5 and its example:

# run every minute, only send mail if ping fails
* * * * *       -n ping -c 1 freebsd.org
usr.sbin/cron/cron/job.c
25

This is in the wrong order, if I'm not misunderstanding style(9).

36

Shouldn't old code be removed instead of commented out?

otis marked 2 inline comments as done.Jul 16 2021, 8:04 PM