\/etc\/crontab<\/code> file. Please note that it can only be modified by the root user. To check the current configuration, you can use the following command:<\/p>\r\n\r\n\r\n\r\nsudo cat \/etc\/crontab<\/pre>\r\n\r\n\r\n\r\nThe output should be similar to the one below:<\/p>\r\n\r\n\r\n\r\n
SHELL=\/bin\/bash\r\nPATH=\/sbin:\/bin:\/usr\/sbin:\/usr\/bin\r\nMAILTO=root\r\n\r\n# For details see man 4 crontabs\r\n\r\n# Example of job definition:\r\n# .---------------- minute (0 - 59)\r\n# | .------------- hour (0 - 23)\r\n# | | .---------- day of month (1 - 31)\r\n# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...\r\n# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat\r\n# | | | | |\r\n# * * * * * user-name command to be executed\r\n37 * * * * root run-parts \/etc\/cron.hourly\r\n23 5 * * * root run-parts \/etc\/cron.daily\r\n19 3 * * 0 root run-parts \/etc\/cron.weekly\r\n23 0 6 * * root run-parts \/etc\/cron.monthly\r\n<\/pre>\r\n\r\n\r\n\r\nAs you can see the crontab file already contain an explanation about how to define your own jobs. The syntax is the following:<\/p>\r\n\r\n\r\n\r\n
minute hour day month day_of_week username command<\/pre>\r\n\r\n\r\n\r\nAn asterisk (*) in the crontab can be used to specify all valid values, so if you like the command to be executed every day at midnight, you can add the following cron job:<\/p>\r\n\r\n\r\n\r\n
0 0 * * * root \/sample_command >\/dev\/null 2>&1<\/pre>\r\n\r\n\r\n\r\nYour cron job will be run at:<\/p>\r\n\r\n\r\n\r\n
2016-06-10 00:00:00\r\n2016-06-11 00:00:00\r\n2016-06-12 00:00:00\r\n2016-06-13 00:00:00\r\n2016-06-14 00:00:00\r\n...<\/pre>\r\n\r\n\r\n\r\nSpecific users can create cron jobs too. The cron jobs for specific users are located in \/var\/spool\/cron\/username<\/code>. When you create cron jobs for specific users you do not need to specify the username in the cron job. Therefore the syntax will be like the one below:<\/p>\r\n\r\n\r\n\r\nminute hour day month day_of_week command<\/pre>\r\n\r\n\r\n\r\n