Linux task Management
There are two types of task management under Linux , each of which is one-time and periodic . Disposable is at and the Batch, periodicity is divided into the system regardless of what and user tasks .
Disposable Tasks :
1. Command format : at [ options ] time
2. Options :
Option name |
Description |
-I ( uppercase I) |
Specify a queue |
-F |
Specify file |
-L ( lowercase l) |
View queues |
-D |
Delete queue |
3.time:teatime noon Midnight Teatime tomorrow Now
4, operation mode: With at command has interactive mode and batch processing two ways.
Interactive is when the user enters at [option] time and waits for the user to continue entering the command to run at the cursor, and then submits the task with ctrl+d . The batch is going to use -F. is the command that the user will run to write to the file, and then use - f to specify the file.
5. Running result: The result of the operation will be sent to the user in the likeness of the mail.
6, and batch difference:Batch can not specify the time, but choose the user system spare time to run.
Recurring tasks:
How it works: Both the system task and the user task are run by the daemon crond reading the user-defined file. When the system task file is /etc/crontab, the user task file is /var/spool/cron/username.
System tasks:
Task definition Format: Each row defines a task. Format is * * * user command
Time Format:*-./ is a symbol that can be used. * represents all the desirable values for this bit. - represents a continuous value in this interval. . represents the discrete value of this interval, /# indicates that at intervals of # run a task once
User tasks:
Command: Use the crontab command. The number of parameters that can be used is the- e call editor in editor to edit,-u Specify user,-l View tasks,-r Delete crontab files.
Examples:
How to achieve a second-level task:* * * * * * for i in {1...4};d o/bin/echo "Hello"; Sleep 1;done
Not divisible how to solve: available at run. Write in the file while true;do ls/sleep 10;done
In addition to the crontab , another command is a supplement to crontab ,anacron.
It is used to detect If a task in the crontab has missed the last run time, and if so, let the task run at some time after power-on.
Shell learns 57 days----Linux task management, summarizing and extending to the previous lecture