In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to use the at command in the Linux system. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
When using shell scripts, you may want to run shell scripts at a specific time. The Linux system provides several ways to run shell scripts at a specific time, one of which is to use the at command.
Introduction to at commands the at command allows you to specify when the Linux system runs the script, and the at command submits the job to the queue, specifying when shell runs the job. At's daemon, atd, runs in background mode, checking the job queue to run jobs. The atd daemon checks a special directory on the system to get the jobs submitted by the at command. By default, the atd daemon checks the directory every 60 seconds. When a job is available, the job elapsed time is checked, and if the time matches the current time, the job is run.
At command format at (option) (parameter) ctrl+D end the input of the at command 12 when using the at command, make sure that the atd process starts.
Ps-ef | grep atd to see if the atd process is started. If you do not start using / etc/init.d/atd start or restart chkconfig atd on to set the atd boot command parameter-m when the specified task is completed, an email will be sent to the user, even if there is no standard output
-an alias for I atq. The atq command can view the jobs waiting on the system
-alias for d atrm. The atrm command deletes a waiting job from the system, followed by the job id to be deleted
-v shows the time when the task will be executed
-c print the contents of the task to standard output
-V displays version information
-Q use the specified queue
-f read the task from the specified file instead of from standard input
-t submit the task to run in the form of a time parameter
The time setting at allows you to use a rather complex set of methods for specifying time.
Can accept the time specified in the hh:mm (hours: minutes) of the day. If that time has passed, it will be executed the next day.
You can also use vague words such as midnight (late at night), noon (noon) and teatime (tea time, usually 4 p.m.) to specify the time.
Users can also use a 12-hour timing system, that is, adding AM (morning) or PM (afternoon) after the time to indicate whether it is morning or afternoon.
You can also specify a specific date for the execution of the command, in the format of month day (month day) or mm/dd/yy (month / day / year) or dd.mm.yy (day. Month. Year). The specified date must follow the specified time.
All of the above are absolute timing, but you can also use relative timing, which is good for arranging orders that will be executed in the near future. The specified format is: now + count time-units,now is the current time, time-units is the time unit, here can be minutes (minutes), hours (hours), days (days), weeks (week). Count is the amount of time, whether it is days, hours, and so on.
Another method of timing is to directly use today (today) and tomorrow (tomorrow) to specify the time to complete the command.
Case demonstration: execute / bin/ls at 5: 00 p.m. Three days later
At 5pm+3 days at > / bin/ls at > tomorrow at 17: 00, the output time will be in the specified file
Ubuntu@ubuntu:~$ at 17:20 tomorrow warning: commands will be executed using / bin/sh at > date > / root/log.log at > job 12 at Sat Jan 26 17:20:00 2019 ubuntu@ubuntu:~$ 123456 after the scheduled task is set, we can use the atq command to check that the system is not performing work tasks before execution
Ubuntu@ubuntu:~$ atq 12 Sat Jan 26 17:20:00 2019 a ubuntu ubuntu@ubuntu:~$ delete tasks that have been set up
Atrm 12 displays tasks that have been set up
At-c 12 on "how to use at commands in the Linux system" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, please share it out for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.