MICROND(8)

NAME
micrond - a minimal cron implementation

SYNOPSIS
micrond [-fhNSsV] [-g [no]GROUP[=DIR]] [-l PRI] [-m MAILER] [-P FILE] [-p DEV] [-t SECONDS] [-v NAME=VALUE] [-W OPTION]

DESCRIPTION
Micrond executes commands periodically as directed by one or more crontabs. Each crontab is a plain text file, where each non-empty line contains a formal schedule and a command that must be run according to that schedule (a cron job). System crontabs also supply the name of the user on whose behalf the command must be run. Per-user crontabs lack this field, since the commands in them are always executed on behalf of the user who owns the crontab.

Normally, a cron jobs is not run if its previous instance is still running. So that if a cron job that is run each minutes takes three minutes to finish, it will be actually run once in three minutes. However, maximum number of cron job instances allowed to run simultaneously can be configured in crontab.

Any output the running job produces on its standard output and standard error is captured. Upon termination, it is mailed to the owner of the job. The message From header is set to the cron job owner name. Its Subject contains the owner login name, hostname of the server where the command was run and the command itself, in the following format: ``Cron <USER@HOST> COMMAND''. A copy of execution environment is included in the message in form of additional X-Cron-Env headers, each containing a single environment variable.

The recipient of the message can be altered by setting the MAILTO variable in the crontab.

The mail is sent using ``/usr/sbin/sendmail -oi -t''. The administrator can supply alternative mailer command via the -m command line option.

Instead of mailing job outputs, micrond can be configured to send them to a particular syslog facility. If so configured, the output is logged synchronously with the job execution. The syslog configuration can be global, using the -s and -o command line options, per-crontab or even per-job, using the _MICRON_SYSLOG_FACILITY variable setting.

On GNU/Linux systems, micrond uses inotify(7) to track crontab modifications. On such systems a crontab is re-read as soon as it is written to disk.

On other systems, micrond checks crontab mtimes each minute and re-reads the crontabs for which its value has changed.

  Crontab groups
There are four collections of crontabs, called crongroups for brevity.

Master crontab
    A single crontab named /etc/crontab. It is owned by root. Only root has write permissions.

    Each active line in this crontab consists of seven fields: first five fields provide a schedule, the sixth field is the login name on the user on whose behalf to run the command, and the rest of line is the command to run.

System crongroup
    The system crongroup comprises crontabs located in the /etc/cron.d directory. They have the same format, ownership and mode as the master crontab. The main purpose of this crongroup is to facilitate packaging, so that each software package may provide its own crontab and install it to a well-known location.

User crongroup
    Contains personal crontabs of system users. Located in /var/spool/cron/crontabs directory, each crontab is owned by the corresponding user and only its owner has read and write permissions.

    Crontabs in this group don't have the username field. The commands in them are always executed on behalf of the crontab owner.

User group crongroup
    Similarly to the user crongroup, it contains individual crontabs of system users. However, each user can have multiple crontabs. Crontabs are located in subdirectories of /var/spool/cron/crongroups named after each particular user. Crontabs have the same format as per-user crontabs (no username field). The owner of the user group can delegate the permission to create crontabs in it to another users by adding them to his primary system group.

    This group is designed mainly for pseudo-users, such as .e.g. httpd or bind, to enable another users to execute commands on behalf of them. This is useful, for example, on servers that host multiple websites.

    This group is experimental and its use must be explicitly enabled using the -g command line option.

OPTIONS

-f  Remain in foreground.

-h  Display a short help summary and exit.

-g GROUP=DIR
    Define the directory or file name for crontab group GROUP. Valid GROUP names are: master, system, user, and group.

-g [no]GROUP
    Enable or disable crontab group GROUP. Note, that the group crontab group is disabled by default.

-l PRI
    Log only messages with syslog priority PRI or higher. Valid arguments in order of increasing priority: debug, info, notice, warning, err, crit, alert, emerg.

-m MAILER
    Set mailer command. Default is ``/usr/sbin/sendmail -oi -t''.

-P FILE
    Write the PID of the cron daemon to FILE. The file will be removed when the program terminates.

-p SOCKET
    Send messages to syslog via this socket. SOCKET is either an absolute file name of a UNIX socket, or a host name or IPv4 address optionally followed by a colon and port number or service name.

-S  When running in foreground (see the -f option), log messages from micrond to the syslog facility "cron", instead of printing them to the standard error. Not to be confused with the -s option, described below.

-s  Log output from cronjobs to syslog. By default, the cron facility is used. Use the -v syslog_facility=F option to change it to facility F.

-t N
    Before exiting, micrond checks if some of the cronjobs are still running. If so, it sends them the SIGTERM signal and waits N seconds for them to terminate. The cronjobs that fail to exit within that amount of time are terminated forcibly by sending them the SIGKILL signal.

    The default timeout is 60 seconds.

-V  Print program version, licensing information and exit.

-v NAME=VALUE
    Assigns initial value for the internal variable NAME. The variable name must be used without prefix. Comparison is case-insensitive. For example:
      -v syslog_facility=daemon

-W OPTION
    Sets internal micrond option. Currently only one such OPTION is implemented: paranoid_memfree. When -Wparanoid_memfree is given, micrond will free all allocated memory before terminating. This option is useful for debugging, or when running micrond under valgrind or another memory leak detector.

SEE ALSO
crontab(1), crontab(5).

COPYRIGHT
Copyright © 2020-2023 Sergey Poznyakoff <gray@gnu.org>
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.