Today I saw at the command and Crontab command, summed up, but also back down the things in their brains to form a whole understanding.
First, at command
This command is used to perform a routine task, such as I want to specify a point in time to save the files in a directory.
/etc/at.allow/etc/at/at.deny These two files determine whether you can use the AT
1, first check whether the AT command is turned on, some do not open
Service ATD Status
If the display running is OK, if it is not turned on, manually open the
Service ATD Start
2, at the start, can write their own task to lazy
Format: at now + time
For example: at now + 5 minutes (Hours/days/weeks)
Or specify the time directly
At 4pm
Ctrl+d end input after command completion
3, the task is finished, want to see if it is successful,
Atq
such as: Sat Apr 21:21:00 a root
4, if the task is not appropriate, then you can delete
ATRM Jobnumber
The jobnumber here is ATQ query out the task number.
Example: ATQ 24
After you delete it, you can use ATQ to see it again.
Second, the cycle of work crontab (Ubuntu environment)
1, first confirm whether crontab open
Service Cron Status
If the running is OK, use service cron start
2. Then the command format is understood
Minute hour day month week script/command
A total of 6 fields, not sure when the execution will write "*"
Like what:
Execute once per minute: * * * * * Scripts/commands
This is the default format.
Every hour: * */1 * * * Script/Command
crontab Command parameters:
-U user
-l lists the user's crontab tasks specified by-U or the users ' tasks
-R Deletes the user's crontab task specified by-U or the task
-e Edit-u specified user's crontab task or task
3. Editing tasks
Crontab-e
Open the crontab file and edit it on the line
After the task is edited successfully, save the rollout and then show crontab:installing new Crontab
4. View Tasks
Contab-l
5. Delete a task
Crontab-r
-e,-r,-l can be combined with-u to provide root to manage other users ' crontab commands
At command and crontab command