Friday, September 11, 2015

Crontab (JOB Schedular)
DESCRIPTION
Crontab is the program used to install, remove or list the tables used to drive the cron(8) daemon. Each user can have their own crontab, and though these are files in /var/spool/ , they are not intended to be edited directly. For SELinux in mls mode can be even more crontabs - for each range. For more see selinux(8).
The cron jobs could be allow or disallow for different users. For classical crontab there exists cron.allow and cron.deny files. If cron.allow file exists, then you must be listed therein in order to be allowed to use this command. If the cron.allow file does not exist but the cron.deny file does exist, then you must not be listed in the cron.deny file in order to use this command. If neither of these files exists, only the super user will be allowed to use this command. The second option is using PAM authentication, where you set up users, which could or couldnât use crontab and also system cron jobs from /etc/cron.d/.
  • /etc/cron.monthly
  • /etc/cron.weekly
  • /etc/cron.daily
  • /etc/cron.hourly
  • /etc/cron.deny


# crontab –e (to create a job schedular)
# vim /etc/cron.deny (we can put users name to deny a job schedular, we don’t needs)
  1. Min minutes 0 - 59
  2. Hr hours 0 - 23
  3. Day of month 1 – 31
  4. Months 1 – 12
  5. Day of week 0 – 7 ( 0 & 7 boths are count in sunday)
  6. Script /command name (put script & shell name or path)
  7. * all ( “ * “ use to comments all )








Job schedular…examples…
Min hours months weeks days > /root/text (file name & path)
28 15 * * * > /root/text
28 15 * * * > /root/tty2
28 15 * * * >/root/pst/0
  • Crontab -l (to view a script )
  • Crontab -r (to remove all job schedular by this command)


*/1 it means script run every one minutes.
*/1 it means script run every one hours.
2 , 15 it means script run on 2nd & 15th date of month.
2 – 15 it means script run on 2nd to continue on 15th date of month.



No comments:

Post a Comment

Linux Tables: Block All Incoming Traffic But Allow SSH

  This is very common scenario. You want to permit access to a remote machine only by SSH. You would like to block all incoming traffic to y...