linux,

Know linux task scheduler and automate

vkosuri vkosuri Follow Mar 17, 2017 · 1 min read
Know linux task scheduler and automate
Share this

The most popular task scheduler for Linux flavours are support crontab. You can automate regular boring tasks using powerful Linux shell scripts.

More information found here crontab man page http://man7.org/linux/man-pages/man5/crontab.5.html

To view a cron job

crontab -l

To edit a cron job

crontab -e

To view a cron job on specific user

sudo crontab -l -u

To edit a cron job on specific user

sudo crontab -e -u

An example cron job delete files in a specified location more than one month

5 4 * * * find /home/malli/Results/Logs/* -type f -name '*.log' -mtime +1 -exec rm -f {} \

This cron job will run every day morning 4 hours 5 minutes

Crontab Format:

MIN HOUR DOM MON DOW CMD Format Meanings and Allowed Value:

MIN     Minute field    0 to 59
HOUR    Hour field      0 to 23
DOM     Day of Month    1-31
MON     Month field     1-12
DOW     Day Of Week     0-6
CMD     Command     Any command to be executed.

Restart cron with latest data

service crond restart
Join Newsletter
Get the latest news right in your inbox. We never spam!
vkosuri
Written by vkosuri Follow
Not a native English speaker or writer, Deutsch Learner, love to explore new ideas and document!.