crontab in UNIX
In UNIX:
- Command: crontab
- Daemon:
crond
- Start Daemon:
/etc/init.d/crond start | systemctl start crond.service
- Stop Daemon:
/etc/init.d/crond stop | systemctl stop crond.service
- Start Daemon:
- Location: /var/spool/cron/etc/crontab
- Limitation:
/etc/cron.allow && /etc/cron.deny
()Priority: allow | deny
- Log: /var/log/cron
- Usage:
crontab [-u username] [-l|-e|-r]
Minute (0~59) | Hour (0~23) | Day (1~31) | Month (1~12) | Week (0~7) | Commands |
---|---|---|---|---|---|
* | * | * | * | * |
These characters can be used:
Character | Representation | Example |
---|---|---|
* | Run any time | 0 15 * * 1 command |
, | Run at sliced time | 0 12 5,10,15 * * command |
- | Run at scope time | 30 9-18 * * * command |
/n | Run every other time | */10 * * * * command |
Example for crontab -e
:
Minute (0~59) | Hour (0~23) | Day (1~31) | Month (1~12) | Week (0~7) | Command |
---|---|---|---|---|---|
*/1 | * | * | * | * | /bin/bash /the/location/of/hcismatdbcycle.sh |
Example:
*/1 * * * *
This is a standard example of the hcismatdbcycle.sh
file:
#!/bin/bash
setroot
hcismatcycle -s tsmatdbCycle -p smatdb2 -t conn_4 -b out -r /work/company/cis19.1/integrator
hcismatcycle -s tsmatdbCycle -p smatdb -t conn_2 -b out
...