crontab editing


crontab

Cron (aka Crontab) is a task scheduler in Linux that helps to execute a task on a scheduled time, and it is very similar to Windows Task Schedulers.

With crontab, we can schedule repetitive tasks as well as one-time tasks using @ utility.

Crontab is mostly used for executing backup scripts for taking the system backups and also sometimes to start and stop applications.
Crontab

Install Crontab


The package name of crontab in CentOS / RHEL is cronie and cron in Ubuntu / Debian. You can install crontab using the below command.

### CentOS / RHEL ###

yum -y install cronie



### Debian / Ubuntu ###

apt-get install cron

Start Crontab


If the crontab is not running, then start it using the following command.

service crond start

Edit crontab


To add or edit crontab jobs of a current logged in user, use the below command. The command will open a file editor where you can update the jobs.


crontab -e

To edit other users crontab jobs, use the below command.

crontab -e -u raj


Crontab path
System wide crontab entries are found in /etc/cron{tab,.d,.daily,.hourly,.monthly,.weekly} and individual users crontab jobs are found in /var/spool/cron/ directory.

Crontab logs

Crontab logs can be found in /var/log/cron



Popular posts from this blog

script and validation for the lvm

Important concepts and bits

shell script to create and extending the volume