Linux Task Scheduling (Cron Jobs)

1- Check all the cron jobs running for logged in user

crontab -l

2- Create a new cron job

crontab -e

3- Using or viewing the cron job of the root user

sudo crontab -u root -l

4- Creating or editing the cron jobs of another user

sudo crontab -u <username> -e

Ubuntu/Mint/Debian

Check if the cron service is running

sudo service cron status

Start the cron service if it’s not already running(use one of the following commands)

sudo /etc/init.d/cron start
sudo service cron strat

Stop Cron Service (use one of the following commands)

sudo /etc/init.d/cron stop
sudo service cron stop

Restart Cron Service (use one of the following commands)

sudo /etc/init.d/cron restart
sudo service cron restart

Redhat (RHEL)/Fedora/CentOS/Rocky/Alma

Check if the cron service is running

systemctl status crond

Start the cron service if it’s not already running(use one of the following commands)

/etc/init.d/crond start
systemctl start crond.service
service crond start

Stop Cron Service (use one of the following commands)

/etc/init.d/crond stop
service crond stop
systemctl stop crond.service

Restart Cron Service (use one of the following commands)

/etc/init.d/crond restart
service crond restart
systemctl restart crond.service

Leave a Reply

one × two =