Regular tasks at

1. at one time to perform regular tasks

1.1 at Service Management and Access Control

  To correct execution of the command at the need atd service support. atd service is an independent service

[root@centos2 ~]# systemctl status atd

  After the service atd start, at the command to work properly. access control at command, at the access control means which allows the user to set the timing of the task using the at command, which does not allow the user or at command. Imagine become the setting blacklist or whitelist setting. at access control is to rely on /etc/at.allow file (white list) and /etc/at.deny file (blacklist) the two files to achieve, specific rules:

    If there /etc/at.allow file system, then only write /etc/at.allow file (whitelist) users can use the at command, other users can not use the at command (/etc/at.deny file is ignored, that is written to the same user both /etc/at.allow file, write /etc/at.deny file, then the user can use the at command, as /etc/at.allow file priority level higher.)

    If the system does not /etc/at.allow file, only /etc/at.deny file, the file is written /etc/at.deny (blacklist) users can not use the at command, other users can use the at command. However, this document does not take effect for the root user.

    If the system is in neither of these files exists, only the root user can use the at command.

  When the system default only /etc/at.deny file, and the file is empty, so the system all users can use the at command. But if we're going to at the user's command authority control, the user writes /etc/at.deny file.

  /Etc/at.allow higher authority file, if /etc/at.allow file exists, the file /etc/at.deny failure. /etc/at.allow management practices more stringent, because only this file written to a user in order to use the at command, if you need to disable at the command of more users, you can put a few users write to the file. /Etc/at.deny file management more loosely, if at command allows the use of more users, you can disable the user to write the file. But these two documents can not enter into force for the root user.

1.2 at the command

[the root @ centos2 ~ ] # at [Option] Time 
Option:
     - m: when at work is completed, whether or not the command the output, both inform the user performs at command by In Email
     - C Job Number: displaying the actual contents of the at work 

time: 
    aT support time following format: 
    HH: MM in the designated "hours: minutes" execute the command, for example: 01 : 10 
    HH: MM YYYY -MM-DD in the designated "hours: minutes Year - month - day" execution , for example: 01 : 10  2019 - 08 - 08 
    HH: MM [AM | PM] [month the] [ dATE ] in designated " hh: mm [am | pm] [month] [date] " to perform, for example, 01 : 10 july 25 
    HH: MM [AM| pm] [minutes | hours | days | weeks] at a specified time "plus how long the implementation of" + patients now 5 minutes, 05am + 2 hours

Case

[root @ centos2 ~] # CAT the Hello. SH  
# ! / bin / bash 

echo  " the Hello world " 

[root @ centos2 ~] # now AT + 1 minutes 
AT > / root / the Hello. SH >> hello.log 
AT > < EOT> Ctrl + d using the task stored at 
job . 1 at Wed-Nov 13 is  . 17 : 44 is : 00  2019 this is the first task at 

[the root centos2 @ ~] # CAT hello.log 
Hello World

1.3 Other administrative commands at

  There are at query and delete commands

[root @ centos2 ~ ] # atq 
# queries at work on the current server 

[root @ centos2 ~ ] # atq
 2     Wed Nov 13  17 : 55 : 00  2019 A root 

[root @ centos2 ~ ] # atrm [job number] 
# deleted specified at the task 

[root @ centos2 ~] # atrm 2 
[root @ centos2 ~ ] # atq 
after No. 2 at # delete task, then there would be no inquiry at the presence of the mission

 

Guess you like

Origin www.cnblogs.com/sswind/p/11847334.html