Linux scheduled task-at Command

Source: Internet
Author: User
Part 1: at Command 1. at Command: execute a specified task at a specified time, only once, and you need to enable the atd process (ps-ef | grepatd view, enable/etc/init. d/atdstartorrestart...

Part 1: at Command
 
1. at Command: to execute a specified task at a specified time, it can only be executed once. you must enable the atd process (ps-ef | grep atd view, and enable/etc/init. d/atd start or restart; run chkconfig -- level 2345 atd on when starting the system ).
[Root @ localhost test] at now + 1 min
At> echo "hello">/dev/tty2 and press enter # send "hello" to the tty2 terminal one minute later
-- Note: Use ctrl + d to terminate character input (that is )
At
At> echo "test at command">/home/test.txt
At
At>/sbin/shutdown-h now # use the absolute path here
The task created by the at command is placed under/var/spool/at. it is a script file and can be edited using vi.
At now + 1 min
At> echo "hello" # At this time, the email will be sent to the currently executed person. you can view the email by using the mail command, that is, use the mail command first, and enter '1' to view the message.
 
Atq command: Queries which tasks are waiting for execution on the current machine. The first column is the work number.
Atrm command: cancel the task. for example: atrm 10 #10 indicates the work number.
Batch commands: execute tasks with a low-priority latency.
Batch
At> echo "hello">/home/abc.txt
 
2. at command security control
/Etc/at. allow # List users who can use the at command. first find the at. allow file and then find the at. deny file.
/Etc/at. deny # List users that cannot use the at command, one row at a time.
If no at. allow file or at. deny file exists, only the root user can execute the at command.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.