- In Unix, you have the capability to schedule the jobs/scripts to run at the specified time.
- We can schedule jobs to run at the specified intervals like once a day or once a week or once a month or once in every hour/5 mins/ 10 mins/ 15 mins etc using crontab.
Each entry in a crontab file consists of six fields, specifying in the following order:
- minute(s) hour(s) day(s) month(s) weekday(s) command(s)
- The above fields should be separated by spaces or tabs. The first 5 fields in above format should be in integer patterns and the 6th should be command to execute.
The below table will describe in detail.
|Field / Value||Description|
|minute / 0-59||The exact minute that the command should execute|
|hour / 0-23||The hour of the day that the command should execute|
|day / 1-31||The day of the month that the command should execute|
|month / 1-12||The month of the year that the command should execute|
|weekday / 0-6||The day of the week that the command should execute (Sunday = 0, Monday = 1, Tuesday = 2 and so on..)|
|command / Special Instruction||The command information needed to execute. It should be either commands, executables (such as scripts), or combinations are acceptable.|
- In the above example, the script or job “myScript.sh” will run for every 15 minutes once all day of week, month and year.
- In the above example, the script “myScript.sh” in the bin directory will be executed on the 1st and 15th of each month, as well as on every Monday.
- In the above example, the script “myScript.sh” from the bin directory will be executed only on Mondays.
- To create the crontab file in Unix, type crontab space filename.
crontab filename or crontab -a filename
Crontab -l :-
To display the crontab file available in Unix system.
Crontab -e :-
- To edit the crontab file available in the Unix.
- It will create the crontab file if it does not exist in the system.
Crontab -r :-
To remove the crontab file from the system.
Crontab -v :-
To display the last time when the crontab file was edited.
OTHER ADVANCED UNIX COMMANDS:
Below are the list of advanced UNIX commands used in UNIX operation system.
1 .GREP Command in Unix
2.Whoami Command in Unix
3.Passwd Command in Unix
4.Kill Command in Unix
5.Ps -Ef Command in Unix
6.Df -k Command in Unix
7.Bdf Command in Unix
8.ftp Command in Unix
9.Find Command in Unix
10.Date Command in Unix
11.Uptime Command in Unix
12.Clear Command in Unix
13.Shift Command in Unix
14.Sort Command in Unix
15.Crontab Command in Unix
16.Unix Command Line Arguments