Automation task In Linux Using Crontab On CentOS 7

Automation task in Linux, Cron daemon is a long-running process that executes commands at a specific time and day. It’s used to scheduling a task in Linux. we can create and set the task to automation using crontab in Linux and let’s see how to edit crontab in Linux to make changes.

Automation task In Linux Using Crontab:

Once you have set the task using it and you can simply hit the URL using elinks. Create a shell file and put the path of crontab in crontab -e with below syntax.

* * * * * /bin/bash  /location_of_cron_file_shell 

Now you have to create a file and in this file add these lines elinks http:ip/projectpath/, where ip= your server IP and path= document root of the website. 

We can schedule at one time task with at command and it has atd 
daemon which is by default installed and enabled automatically. We’ve
another way to schedule a task with crontab command

Check Out: How To Clear Cache In Linux

Syntax of at command is at <timespec>  and after writing the command you can finish it with ctrl+D

To view pending job by atq or at –L

If you want to remove a job use this atrm <jobnumber>

Scheduling jobs :

crontab –L          - list the jobs for current user
crontab –r          - remove all job of current user

For editing the crontab 
crontab –e         

Check Out: Installation of Awstats For Analyzing Apache Logs

Format of crontab:

{min(s)   hour(s)    day(s)   month(s)   weekday(s)   command(s) }
min(s) – > 0-59 
hour(s) -> 0-23
day(s) -> 1-31
month(s) -> 1-12
weekday(s) -> 0-6

crontab –v displays the last time you edited your crontab file 

You’re done crontab create task how to edit crontab in linux set 

Share on:

I'm the founder of Curious Viral. I hope this blog will provide you complete information about Linux Technology & I would like to share my technical knowledge with you which I have learned during this period.

Other Posts You May Like...

Leave a comment