Let's review the previous section:
1. Switch User identity command su
2. Execute the action command as root sudo
3. Job: Configure sudo permissions to User1, do not use password, can execute Useradd command
Add the following configuration entry in the/etc/sudoers file
User1 all= (All) nopasswd:/sbin/useradd
In this section, let's take a look at two commands for routine task management.
What is a routine task? A timed occurrence of one or more recurring operations, called a routine task. There are two commands in Linux, one is at for execution at a particular time, and Cron commands are used to perform recurring tasks.
1. At command
Basic usage at time, you first specify an hour, and you are prompted to enter the command to execute at that time, such as:
EOT is the system output after we execute the CTRL+D command, indicating the end of the input.
Above is what we use ll command to do as a task in 5 minutes after execution
Use At–l or ATQ to view the list of tasks,
From the list we can see the ID of the task and the task execution time, as well as the creator of the task.
View task details using the AT–C task ID
Above, only the most core information is displayed, you can see our command is LL.
The time format of the AT command can be
Minute??? At now + 5 minutes?? The task runs after 5 minutes
Hour????? At now + 1 hour????? The task runs after 1 hours
Days????? At now + 3 days????? The task runs after 3 days
Weeks???? At now + 2 weeks???? The task runs after two weeks
Fixed???? At midnight????????? Task runs at midnight
Fixed???? At 10:30pm?????????? Task at 10:30 in the evening
Fixed???? At 23:59 12/31/2018 Mission on December 31, 2018 23:59
You can delete a task by using the AT–D task ID or the ATRM task ID
Job: Create a task, shut down after 10 minutes, the command to shut down the machine is shutdown
Free video tutorial on public number "get kicked genius" gets
Linux System Command Learning Series-Routine task management at command