summaryrefslogtreecommitdiffstats
path: root/usr.sbin/cron (follow)
Commit message (Collapse)AuthorAgeFilesLines
* rename the "options" field to "flags" (as suggested by millert): an optionaljmc2020-04-181-20/+16
| | | | | | | | | | | options field was difficult to describe concisely; - tweak wording accordingly - sort flags - condense STANDARDS to avoid text repitition, as suggested by deraadt - document flags may be combined, now deraadt fixed the parsing ok millert deraadt
* Rewrite the flag-parsing code to be getopt-like. Tight formations likederaadt2020-04-181-37/+32
| | | | | -ns are now possible, as well as (useless) repetition like -nnn. ok millert
* Log skipped jobs in job_add() not job_runqueue().millert2020-04-171-5/+7
| | | | | We want to log when the job is added but will not be run, not every time the run queue is processed.
* Reflow text so that the -[nsq] options are described as an optional [options]deraadt2020-04-161-24/+34
| | | | | | field before command, rather than muddling up the command description to explain them messily as some sort of exception ok millert
* Add a mechanism to prevent cron jobs from running concurrently.millert2020-04-168-16/+98
| | | | | | This adds a new "-s" flag to the command field which indicates that only a single instance of the job should run concurrenty. OK beck@ job@ deraadt@
* Add support for random values using the '~' operator.millert2020-04-152-20/+65
| | | | | | | For example "0~30" will result in a random value between 0 and 30 inclusive. If either (or both) of the numbers on either side of the '~' are omitted, the appropriate limit (low or high) for the field will be used. OK deraadt@ beck@ jmc@
* Remove setlocale(3) calls. I checked that no functions are called thatschwarze2020-02-112-7/+2
| | | | | | | | | | | are actually locale-dependent on OpenBSD, and the programs should better not be locale-dependent even when compiled on other systems. millert@ points out that the month and weekday names in the fourth and fifth columns of crontab(5) could in theory be made locale-dependent, but we certainly don't want that, and currently, they are only compared against static const char * arrays in entry.c containing English names. Patch sent in by Jan Stary <hans at stare dot cz>. OK millert@
* Add "-n" to EXAMPLES in crontab(5)'s man pagejob2020-01-061-4/+9
| | | | OK Ingo Schwarze
* delete ridiculous DIAGNOSTICS section that goes without sayingschwarze2020-01-061-5/+2
|
* Use strtonum(3) in atrun. Also limit uid/gid to UID_MAX-1 andmillert2019-10-201-76/+99
| | | | GID_MAX-1 for good measure. OK deraadt@
* snprintf/vsnprintf return < 0 on error, rather than -1.deraadt2019-07-031-3/+5
|
* When system calls indicate an error they return -1, not some arbitraryderaadt2019-06-285-24/+24
| | | | | | value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
* I am retiring my old email address; replace it with my OpenBSD one.millert2019-01-252-5/+5
|
* Unused variable.krw2018-07-131-2/+1
| | | | ok deraadt@
* retire the old cron socket path; ok jca millertderaadt2018-07-112-6/+2
|
* zap a stray ';' and make a comment less uglytb2018-06-131-5/+2
|
* avoid a double flag;jmc2018-06-131-2/+2
|
* Add crontab entry option -n for "No mail when run successful"job2018-06-134-60/+95
| | | | OK jmc@ millert@
* Pass a FILE * instead of a file descriptor into load_user() andmillert2018-02-053-19/+18
| | | | | | perform the fclose() in process_crontab(). Previously we were closing the crontab fd twice--once in load_user() via fclose() and once in process_crontab(). OK tb@
* Open a bunch of fds with O_CLOEXECjca2017-10-252-5/+8
| | | | Not needed in theory, but could prevent accidental leaks. ok millert@
* Close the socket (and dfd) in at(1) child processesjca2017-10-233-4/+9
| | | | | Fixes a failure at restart if a child process still has the socket opened. Spotted by millert@, ok friehm@ millert@
* Close cron sockets in child processes.friehm2017-10-231-1/+4
| | | | ok jca@
* update permissions info to match recent changesmillert2017-06-081-4/+5
|
* Add logging for when we find a non-file in the at spool that wasmillert2017-06-081-4/+10
| | | | a file when we scanned the at spool earlier.
* In cron(8), require that crontab and at files in the spool be ownedmillert2017-06-076-46/+86
| | | | | | | | | | | | | | | by group crontab. The at(1) command now creates files owned by group crontab, the crontab(1) command already does this. Files in the crontab spool with parse errors are now ignored; crontab(1) will not install a crontab file with parse errors. The system crontab file (/etc/crontab) is not affected by this. The required permissions on crontab files have been tightened. Files in the cron spool must be mode 0600 (as created by crontab(1)). The system crontab file may be readable/writable by the owner, readable by group and readable by other. The system crontab must be readable by the owner.
* When running at jobs, open the at spool and use the directory fdmillert2017-06-071-14/+25
| | | | | | with openat(), fstatat() and unlinkat(). This is similar to how we run cron jobs and eliminates the need for run_job() to find the basename of the at file. OK deraadt@
* Set the group on cron's Unix domain socket _before_ making itmillert2017-06-051-2/+2
| | | | group-writable, not after. Pointed out by Solar Designer.
* Document the "-q " prefix accepted in the "command" field.schwarze2016-10-121-2/+13
| | | | | | Original patch from Wouter Clarie <wclarie at gmail com>, tweaked in joint work with jca@, OK millert@, OK jca@ on an earlier version.
* Fix fd leak on error. OK jsg@millert2016-08-301-8/+10
|
* When caching the mtime of the spool directory and system crontab files,millert2016-01-115-20/+30
| | | | | stash a struct timespec, not just a time_t. Fixes a bug where cron could skip re-reading the spool after two consecutive changes.
* Check pipe(2) return value; noticed by deraadt@millert2015-11-172-5/+10
|
* Check for setgid() failure before executing editor and warn ifmillert2015-11-171-4/+8
| | | | exec of shell + editor fails.
* Clean up the remaining uses of stderr and perror() and use warn/errmillert2015-11-155-108/+128
| | | | | | and/or syslog depending on whether stderr is hooked up at the time. Also remove closelog() which is not needed since we are headed for exec. OK guenther@
* Cleanup from unifdef: set sact.sa_flags to SA_RESTART instead ofmillert2015-11-141-3/+2
| | | | clearing it and then ORin in SA_RESTART.
* Remove log_it() and call syslog(3) directly using the same format:millert2015-11-148-125/+94
| | | | | | | | "(username) WHAT (details)". Logs due to normal operation (e.g. crontab operations or running commands) are logged at LOG_INFO like before. Actual errors are logged at LOG_ERR, less important things are logged at LOG_WARNING OR LOG_NOTICE. Also ignore SIGHUP now that there is no log file to reopen.
* new location for cron sockets; ok millertjmc2015-11-121-3/+3
|
* Use absolute paths in pathnames.h. There is no longer a need tomillert2015-11-1210-285/+110
| | | | | | | | chdir(2) to the cron dir and cron(8) now changes to / via daemon(3). We no longer try to create/chmod the spool directories as they should be set correctly at install time. The setegid(crontab) has been moved to open_socket() so it is closer to the chmod(2) call that needs it. OK deraadt@ tedu@
* Remove SIGNALS section now that the non-syslog code has been removed.millert2015-11-121-16/+2
|
* Move cron socket to /var/run/cron.sock. Client code will try the oldmillert2015-11-124-15/+23
| | | | | | location if the new one doesn't exist for now. In order to allow the fchown() to succeed, cron now sets its effective gid to crontab. OK jca@ deraadt@
* Use warn/warnx and err/errx. OK jca@millert2015-11-111-102/+62
|
* Niether cron nor crontab need flock permission.millert2015-11-112-4/+4
|
* Remove obsolete utime() call. It predates the use of a socket tomillert2015-11-111-4/+1
| | | | prod cron into checking the spool dir.
* Fix spool dir mode check to avoid extraneous chmod() calls.millert2015-11-111-3/+3
|
* For "crontab -u user -e" change the euid for the mkstemp() callmillert2015-11-111-9/+18
| | | | | instead of calling fchown() after the fact. Fixes a pledge() issue. OK semarie@
* exit on pledge failure, oopsderaadt2015-11-111-2/+4
|
* Remove unused xpid argument to log_it().millert2015-11-098-65/+63
|
* Update CRONDIR comment to reality.millert2015-11-091-4/+5
|
* Rename AT_DIR -> AT_SPOOL and SPOOL_DIR -> CRON_SPOOL to improvemillert2015-11-097-57/+57
| | | | readability.
* Use fstatat() when checking the files in the at queue so wemillert2015-11-091-40/+27
| | | | don't need to chdir to the queue dir. OK guenther@
* queue(3) instead of homegrown queues and lists. This also fixesmillert2015-11-097-170/+130
| | | | some potential memory leaks in error paths. OK guenther@