ServerCake India

What is the crond in Linux command?

crond Graphical Illustration

crond daemon or cron is used to execute cron jobs in the background. It is nothing but the daemon that handles and executes commands to run the cronjobs in accordance with the specified schedule. All the schedules and required corresponding commands are stored in the file “crontab”. The full directory path to access this file in Linux is /etc/crontab. In another word, the crond is a server daemon that performs a long-running process in order to execute commands at specified date and time as per the assigned Cron job. It is started during system startup from the /etc/rc.d/init.d/crond file. The cron program itself is located under /usr/sbin/crond.

Examples for crond:

1. Start cron daemon in the foreground

If crond doesn’t start by default on the system, and for testing temporarily, execute it in the foreground using option -n

# crond -n

2. Use custom mail (or custom log) for sending cron output

By the default cron job sends the output using Sendmail. If wants to customize a mail program (other than Sendmail), or log the cron output using some custom shell script, use the option -m.

In this case, the custom shell script (or) custom-mail-program accepts the mail message from the standard input and should parse the mail header to get the recipient mail address, then it will be sent to it.

# crond -m [custom-shell-script | custom-mail-program]

3. Send cronjob output to syslog

By the default cron job sends the output using mail. If you like the cron job output to go to syslog, use the option -s. This is a good choice when your system doesn’t have the ability to send an email of the cron job output.

# crond -s

4. Allow any crontab set by users

Using option -p, the cron daemon can allow any crontab that is been set by the users

# crond -p

Editorial Team

Editorial Team at ServerCake India Blog is a team of experts in Server Administration, Business Development, Management, SEO Analyst & Graphic Designers with more than 5+ years of expertise.

Add comment