aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/cron
Commit message (Collapse)AuthorAgeFilesLines
* Second attempt to add @every_second keyword support. Due to multipleMaxim Sobolev2012-10-254-30/+149
| | | | | | | | | | | | | | | | | requests, default to the previous 60-seconds scheduling method unless there is any @every_second entries to conserve CPU cycles and power. This change also improves scheduling in the default mode by running as close to the beginning of the minnute as possible by replacing sleep(3) with nanosleep(2). Previously, the tasks would run anywhere within the first second of the minute and that offset drifted back and forth each time cron(8) was engaged. MFC after: 1 month Notes: svn path=/head/; revision=242101
* Fully backout latest changes.Maxim Sobolev2012-10-182-49/+6
| | | | | | | Pointy hat to: sobomax Notes: svn path=/head/; revision=241672
* Remove harmless, but superfluous local change that creeped in alongMaxim Sobolev2012-10-171-1/+0
| | | | | | | with the r241649. Notes: svn path=/head/; revision=241651
* Revert latest changes to cron, until better version is worked out (I hope).Maxim Sobolev2012-10-174-45/+10
| | | | | | | Requested by: few Notes: svn path=/head/; revision=241649
* o Use nanosleep(2) to sleep exact amount of time till the next second,Maxim Sobolev2012-10-171-6/+48
| | | | | | | | | | | | | | | not multiple of 1 second, which results in actual time to drift back and forth every run within 1 second of the actual action has been set for. Suggested by: Ian Lepore o Schedule the first run in 1 second after starting up, not on the boundary of the next minute, which results in the every_second jobs not being run. Notes: svn path=/head/; revision=241625
* Properly handle non-keyword case by setting e->second to 0.Maxim Sobolev2012-10-161-0/+1
| | | | Notes: svn path=/head/; revision=241618
* Add per-second scheduling into the cron(8). Right now it'sMaxim Sobolev2012-10-154-9/+45
| | | | | | | | | | | | | | | | | | | | only available via the new @every_second shortcut. ENOTIME to implement crontab(5) format extensions to allow more flexible scheduling. In order to address some concerns expressed by Terry Lambert while discussing the topic few years ago, about per-second cron possibly causing some bad effects on /etc/crontab by stat()ing it every second instead of every minute now (i.e. atime update), only check that database needs to be reloaded on every 60-th loop run. This should be close enough to the current behaviour. Add "@every_minute" shortcut while I am here. MFC after: 1 month Notes: svn path=/head/; revision=241576
* Fix build with LOG_FILE undefined and DEBUGGING disabled.Sergey Kandaurov2012-10-021-0/+2
| | | | Notes: svn path=/head/; revision=241125
* Fix build with DEBUGGING disabled.Sergey Kandaurov2012-10-021-0/+4
| | | | Notes: svn path=/head/; revision=241124
* Rework all non-contributed files that use `struct timezone'.Ed Schouten2012-09-011-2/+1
| | | | | | | | | | | | | | | | | This structure is not part of POSIX. According to POSIX, gettimeofday() has the following prototype: int gettimeofday(struct timeval *restrict tp, void *restrict tzp); Also, POSIX states that gettimeofday() shall return 0 (as long as tzp is not used). Remove dead error handling code. Also use NULL for a nul-pointer instead of integer 0. While there, change all pieces of code that only use tv_sec to use time(3), as this provides less overhead. Notes: svn path=/head/; revision=239991
* Add a one second sleep before touching the spool directory. If the touchJohn Baldwin2012-07-021-0/+9
| | | | | | | | | | | | occurs in the same second as the earlier operations to create the temporary file and the cron(8) daemon is rescans the spool directory during that second, then the daemon may miss a cron edit and not properly update its internal database. MFC after: 1 month Notes: svn path=/head/; revision=238024
* As cron(8) is started with '-s' by default, timezones that observeGlen Barber2012-04-281-4/+15
| | | | | | | | | | | | | | | | DST should not need to worry about scheduling jobs when the DST time changes. Rather than removing the BUGS section in crontab(5) regarding this, note that disabling '-s' may still cause jobs to be executed twice or not at all. PR: 166318 Submitted by: Florian k Unglaub (f.unglaub%googlemail!com) MFC After: 1 week Notes: svn path=/head/; revision=234775
* Drop setuid status while doing file operations to prevent potentialXin LI2012-02-271-12/+21
| | | | | | | | | | | information leak. This changeset is intended to be a minimal one to make backports easier. Reviewed by: kevlo, remko MFC after: 1 week Notes: svn path=/head/; revision=232202
* Since April 2, 2006, Indiana has observed DST.Sean Farley2012-01-281-2/+2
| | | | | | | MFC after: 5 days Notes: svn path=/head/; revision=230655
* Spelling fixes for usr.sbin/Ulrich Spörlein2011-12-304-5/+8
| | | | Notes: svn path=/head/; revision=228990
* Point out that @reboot runs at every cron startup, not just systemWarren Block2011-11-251-1/+1
| | | | | | | | | | | | startup. Discussed on: hackers@ Approved by: gjb (mentor) MFC after: 1 week Notes: svn path=/head/; revision=227981
* List /var/cron/tabs in FILES and add descriptions for the other entries.Christian Brueffer2010-05-141-1/+5
| | | | | | | | | | PR: 145912 Submitted by: Julian H. Stacey <jhs@berklix.com> Obtained from: OpenBSD MFC after: 1 week Notes: svn path=/head/; revision=208054
* The last big commit: let usr.sbin/ use WARNS=6 by default.Ed Schouten2010-01-021-0/+2
| | | | Notes: svn path=/head/; revision=201390
* Avoid sshd, cron, syslogd and inetd to be killed under high-pressure swapAttilio Rao2009-11-251-0/+4
| | | | | | | | | | | | | | | | | environments. Please note that this can't be done while such processes run in jails. Note: in future it would be interesting to find a way to do that selectively for any desired proccess (choosen by user himself), probabilly via a ptrace interface or whatever. Obtained from: Sandvine Incorporated Reviewed by: emaste, arch@ Sponsored by: Sandvine Incorporated MFC: 1 month Notes: svn path=/head/; revision=199804
* Fix typo.Sergey Skvortsov2008-12-011-1/+1
| | | | | | | Approved by: ru Notes: svn path=/head/; revision=185525
* remove a pointless prototype and static-fy the corresponding functionMatteo Riondato2008-11-181-2/+1
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=185043
* use WARNS?= instead of WARNS=Matteo Riondato2008-11-181-1/+1
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=185042
* Be more precise and use sizeof(tn)Matteo Riondato2008-11-181-1/+1
| | | | | | | | | Pointed out by: glewis@ MFC after: 3 days Notes: svn path=/head/; revision=185041
* Use WARNS?= instead of WARNS=Matteo Riondato2008-11-181-1/+1
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=185040
* Make usr.sbin/cron/crontab and usr.sbin/cron/lib WARNS=3 cleanMatteo Riondato2008-11-106-23/+20
| | | | | | | | | Tested with: make universe MFC after: 3 days Notes: svn path=/head/; revision=184809
* Revert to previous revision.Matteo Riondato2008-11-091-23/+0
| | | | | | | | | I should not commit anything at 3.50 AM. In addition to danfe's comments, I got others. I'll work on a better version of the patch. Notes: svn path=/head/; revision=184784
* Don't leave files in /var/cront/tabs when interruptedMatteo Riondato2008-11-091-0/+26
| | | | | | | | PR: 17363 MFC after: 3 days Notes: svn path=/head/; revision=184780
* Be paranoid and use snprintfMatteo Riondato2008-11-091-7/+7
| | | | | | | | | PR: bin/122137 Submitted by: Steven Kreuzer <skreuzer@exit2shell.com> MFC after: 3 days Notes: svn path=/head/; revision=184779
* Be paranoid and zero out passwdMatteo Riondato2008-11-061-0/+2
| | | | | | | | | | PR: 122070 Submitted by: Steven Kreuzer <skreuzer@exit2shell.com> Reminded by: gnn@ MFC after: 3 days Notes: svn path=/head/; revision=184706
* Fix empty mailto (-m "") handling: somehow I missed all checks but the first,Dmitry Morozovsky2008-08-011-1/+3
| | | | | | | | | | | | hence output would be written to the wrong filehandle. Submitted by: reg Approved by: yar (implicit) MFC after: ASAP Pointy hat to: marck Notes: svn path=/head/; revision=181115
* Add -m option to cron(8), overriding default mail recipient for cron mails,Dmitry Morozovsky2008-06-294-17/+36
| | | | | | | | | | | | | | unless explicitly provided by MAILTO= line in crontab. This feature can be useful in massive hosting environment, where most users do not care about autogenerated mails. Setting recipient to null string disables default mails at all. Approved by: yar MFC after: 4 weeks Notes: svn path=/head/; revision=180096
* Cleanup of userland __P useKevin Lo2007-11-077-76/+78
| | | | Notes: svn path=/head/; revision=173412
* Fixed static linkage (build with -DNO_SHARED).Ruslan Ermilov2007-10-011-1/+1
| | | | | | | Approved by: re (kensmith) Notes: svn path=/head/; revision=172402
* Add PAM support to cron(8). Now cron(8) will skip commands scheduledYaroslav Tykhiy2007-06-177-8/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | by unavailable accounts, e.g., those locked, expired, not allowed in at the moment by nologin(5), or whatever, depending on cron's pam.conf(5). This applies to personal crontabs only, /etc/crontab is unaffected. In other words, now the account management policy will apply to commands scheduled by users via crontab(1) so that a user can no longer use cron(8) to set up a delayed backdoor and run commands during periods when the admin doesn't want him to. The PAM check is done just before running a command, not when loading a crontab, because accounts can get locked, expired, and re-enabled any time with no changes to their crontabs. E.g., imagine that you provide a system with payed access, or better a cluster of such systems with centralized account management via PAM. When a user pays for some days of access, you set his expire field respectively. If the account expires before its owner pays more, its crontab commands won't run until the next payment is made. Then it'll be enough to set the expire field in future for the commands to run again. And so on. Document this change in the cron(8) manpage, which includes adding a FILES section and touching the document date. X-Security: should benefit as users have access to cron(8) by default Notes: svn path=/head/; revision=170890
* Fix a bug where HOME was not allowed to be overridden by an user's crontabWill Andrews2007-03-081-8/+10
| | | | | | | | | | | as crontab(5) states it can be. This is supported by all vixie-cron derived implementations; not sure why FreeBSD was any different. PR: bin/106442 MFC after: 2 weeks Notes: svn path=/head/; revision=167328
* Behave as documented when reading fields saying "X/Y" where X != *Brian Somers2006-09-261-1/+3
| | | | | | | | | rather than mis-parsing them as "X". MFC after: 1 day Notes: svn path=/head/; revision=162666
* Use a #define to refer to /etc/crontab.Ruslan Ermilov2006-09-031-2/+2
| | | | Notes: svn path=/head/; revision=161964
* Don't use "implicit int". Move the opening { of the functions to the nextStefan Farfeleder2006-07-201-2/+4
| | | | | | | line while there. Notes: svn path=/head/; revision=160521
* o Finally learn how to spell "privileges".Maxim Konovalov2006-06-112-2/+2
| | | | | | | English trainer: ceri Notes: svn path=/head/; revision=159527
* o Spell "privledges" correctly. Re-style comment.Maxim Konovalov2006-06-112-3/+5
| | | | Notes: svn path=/head/; revision=159523
* o Better be safe than sorry: check return code from setuid(2),Maxim Konovalov2006-06-012-8/+30
| | | | | | | | | | | setgid(2), setlogin(2) and initgroups(3). In theory they could fail for root with some third party mac(4) policies. Submitted by: Kostik Belousov MFC after: 1 month Notes: svn path=/head/; revision=159142
* /etc/crontab is similar enough to parse as correct if you runBrooks Davis2006-01-101-0/+4
| | | | | | | | | | | | "crontab /etc/crontab", but not the same format due to the who field. Add some limited anti-foot-shooting support and refuse to load /etc/crontab as someone's crontab. Users wishing shoot their foot in this manner may copy /etc/crontab elsewhere. :) MFC After: 1 week Notes: svn path=/head/; revision=154166
* Pidfiles should be created with permission preventing users from openingPawel Jakub Dawidek2005-09-161-1/+1
| | | | | | | | | | them for reading. When user can open file for reading, he can also flock(2) it, which can lead to confusions. Pointed out by: green Notes: svn path=/head/; revision=150214
* Use pidfile(3) in cron(8).Pawel Jakub Dawidek2005-08-244-63/+29
| | | | | | | | | | Note, that when cron(8) cannot create pidfile, it'll exit. I didn't changed this behaviour, but its better to ignore errors other than EEXIST, so daemon can be started on systems where /var/ file system doesn't support locking (like NFS without rpc.lockd(8)). Notes: svn path=/head/; revision=149430
* Mention the default value of PATH and that it may be overridden.Christian Brueffer2005-07-311-2/+7
| | | | | | | | Submitted by: Roman Divacky MFC after: 3 days Notes: svn path=/head/; revision=148595
* Remove kludges intended to support src trees with partial obj trees.Dag-Erling Smørgrav2005-06-101-4/+0
| | | | | | | Discussed with: ru Notes: svn path=/head/; revision=147225
* Fix parsing of '0' and non-alphanumerics in steps. Previously, anXin LI2005-02-141-1/+3
| | | | | | | | | | | | | entry having stepping value of zero can cause crontab to hang there, and if the main crontab is being changed in this way, then cron(8) will keep spining. Obtained from: OpenBSD [src/usr.sbin/cron/entry.c,v 1.17] PR: 68683 (my own, but forgot to commit it...) MFC After: 1 week Notes: svn path=/head/; revision=141915
* Expand contractions.Ruslan Ermilov2005-02-132-3/+3
| | | | Notes: svn path=/head/; revision=141851
* Expand *n't contractions.Ruslan Ermilov2005-02-132-9/+9
| | | | Notes: svn path=/head/; revision=141846
* Properly initialise the variable `deny'.Stefan Farfeleder2005-02-091-1/+1
| | | | Notes: svn path=/head/; revision=141571