Linux Start Restart and Stop The Cron or Crond Service

How do I start, restart and stop the cron service under Linux / UNIX / BSD like operating systems?

Cron (crond) daemon or service is use to execute scheduled commands or scripts. cron wakes up every minute, examining all stored crontabs, checking each command to see if it should be run in the current minute.

If you are using Redhat (RHEL)/Fedora Core/Cent OS Linux use the following commands.

Task: Start cron service

To start the cron service, use:
# /etc/init.d/crond start

Task: Stop cron service

To stop the cron service, use:
# /etc/init.d/crond stop

Task: Restart cron service

To restart the cron service, use:
# /etc/init.d/crond restart

If you are using Debian or Ubuntu Linux the following commands.

Task: Debian Start cron service

To start the cron service, use:
# /etc/init.d/cron start
OR
$ sudo /etc/init.d/cron start

Task: Debian Stop cron service

To stop the cron service, use:
# /etc/init.d/cron stop
OR
$ sudo /etc/init.d/cron stop

Task: Debian Restart cron service

To restart the cron service, use:
# /etc/init.d/cron restart
OR
$ sudo /etc/init.d/cron restart

Task : Start the cron service at boot time

It is recommended that you start the service at boot time so that job can run w/o problems.

If you are using Redhat (RHEL)/Fedora Core/Cent OS Linux use the following commands to ensure that the service remains enabled after a reboot:
# chkconfig crond on
You can use a text based GUI tool called ntsysv to enable crond service:
# ntsysv

If you are using Debian or Ubuntu Linux use the following commands to ensure that the service remains enabled after a reboot:
# rcconf
OR
$ sudo rcconf
You can use command line tool update-rc.d:
# update-rc.d cron defaults
OR
$ sudo update-rc.d cron defaults

Want to read Linux tips and tricks, but don't have time to check our blog everyday? Subscribe to our daily email newsletter to make sure you don't miss a single tip/tricks. Subscribe to our weekly newsletter here!

{ 8 comments… read them below or add one }

1 jeroen 09.04.08 at 11:12 pm

hehe some of your headings show “corn” instead of “cron”….the same typo I have been making :)

2 vivek 09.05.08 at 6:02 am

jeroen,

Thanks for the heads up. The faq has been updated.

3 hari 09.24.08 at 9:35 am

Hi,
i need to set classpath env variable for the scripts run by cron. i tried using bashrc, but it didnt work.. can anyone help me in this?

4 santosh 12.17.08 at 4:26 pm

hello,
i have cron.php file and i want run this script in every 10 minut . my file directory structure is /var/www/html/.
so any one help me

5 Albert 03.12.09 at 3:53 pm

There’s an “OPR” instead of “OR”.
Nice howto though, thanks!

6 Anthony 03.30.09 at 6:48 am

got a mail server setup using Fedora Core 2. A power outage occured which unfortunately the UPS didnt hold. errors generated when start up;
***An error occured during the file system check. Dropping you to a shell; the system wll reboot when you leave the shell. Give root password for maintanance (or type Control -D to continue)

After rebooting this is what happened;

setting up Logical Volume Management: /dev/hdc: open failed: No medium found (FAILED)

Can you point me in the right direction please?

7 lizz 04.16.09 at 9:21 am

thanks! worked out nicely

8 Abhishek 06.24.09 at 9:07 am

I think you corrupted your / partition ,try to run e2fsck command if this doesnt work ,use linux rescue and check all entries in /etc/fstab and verify whether it is correct

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Tagged as: , , , , , , , , , , , , , , , , , , , , ,

Previous post: Linux or UNIX change file permissions recursively ( conditional )

Next post: Linux Disable / Remove The Iptables Firewall