Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the common command at in Linux

2025-03-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "Linux common command at how to use", the content is easy to understand, clear, hope to help you solve doubts, the following let the editor lead you to study and learn "Linux common command at how to use" this article.

Linux commonly used commands at scheduled tasks, specify a time to execute a task, can only be executed once. Need to install at service, apt-get install at

At command introduction 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.

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.

The at command uses the at command format: the at [- f filename] time,-f parameter is used to specify the shell script name, and time is used to specify the run time.

# run the test13.sh script immediately # at command displays the id and run time assigned to the job $at-f test13.sh now job 1 at Sat Dec 17 23:26:09 2016 # atq command can view waiting jobs in the system $atq 1 Sat Dec 17 23:26:00 2016 2 Sat Dec 17 23:31:00 2016 3 Sat Dec 17 23:32:00 2016 # atrm command can delete waiting jobs in the system Followed by the job to be deleted id $atrm 1$ atq 2 Sat Dec 17 23:31:00 2016 3 Sat Dec 17 23:32:00 2016 4 Sat Dec 17 23:36:00 2016 5 Sat Dec 17 23:37:00 2016at execution time setting can accept standard hour time, hh:mm (hours: minutes) type of time. If that time has passed, it will be executed the next day. For example, 13:12.

A specific namable time, such as now,noon,teatime (usually 4 p.m.) and other vague words to specify the time.

AM/PM indicator, using a 12-hour timing system, such as 10:10 AM.

Standard date format, MMDDYY,MM/DD/YY, etc., for example, 12-31-16.

Time increment, such as now+25 min,10:17+7 days.

You can use today and tomorrow to specify the time.

Note: Mac at command default US time, reload com.apple.atrun.plist, terminal operation:

Sudo launchctl unload-F / System/Library/LaunchDaemons/com.apple.atrun.plist sudo launchctl load-F / System/Library/LaunchDaemons/com.apple.atrun.plist are all the contents of this article entitled "how to use at in Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report