In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how linux creates scheduled tasks. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.
schedule a task to be performed once at a time
batch: Schedule jobs to execute once when the system is not heavily loaded
Step 1:#service atd start Start one-time scheduled task at time
1, absolute timing method midnight HH:MM[today]HH: MM [tommorow]HH:mm week HH:MM mm/dd/yy 2, relative timing method
The code is as follows:
now + n minutesnow + n hours
now + n day
Specify that a command be executed today at 5:30 p.m.(assuming 12: 30,9/16/2009) at5:30pmat17:30at17:30 today +5hoursatnow+300 minutes at 17:3016.9.2009at17:309/16/2009
The specified time is not yet up. We can also write the command we want to execute to a file. You can edit/bin/echo"###########">a.txt#at-fone.txt10:30 in the file.
at-f file point in time at/bin/cp/root/*/home/>bin/echo"111111">/root/one.txt
Ctrl+d exit at-l view or atqat-d or atrm delete scheduled tasks
at execution results and configuration files
The result of at is sent by mail to the user who submitted the command
At configuration file: restrict which users can use at command/etc/at.allow If this file exists, then only the users listed in this file can use at command. If this file does not exist, check/etc/at.deny
/etc/at.deny If this file exists, none of the users listed in the file can use the at command.
If neither file exists, only root can use the at command. If both files exist and are empty, all users can use the at command.
periodic scheduled tasks: crond#servicecrondstart Start periodic scheduled tasks
The crond process searches for crond files and loads them into memory
crontab file is a file named after the user in the/var/spool/cron/directory
After the crond process starts, it first checks whether the user has set up the crontab file, and if it does not go to "sleep" state to release system resources, the crond process wakes up every minute,
Check the crontab file to see if there are any commands that need to be executed. After the command is executed, any output will be sent as mail to the crontab owner.
#crontab-e Edit periodic tasks
#crontab-l View scheduled tasks
#crontab-r Delete the current scheduled task
Format of writing plan task book:
The code is as follows:
Time-sharing day month week
[0--59][0--23][1--31][1--12][0--7](0ro7issun)
*/23,5,71-5
Every two minutes at three, five, seven Monday through Friday.
None of these items can be blank, they must be filled in
If you do not need to specify several of them later, you can use wildcard "*" to indicate
Multiple values can be specified for each time period, separated by commas, 5-6*/3
Command should give absolute path
User must have permission to run crontab
The code is as follows:
/etc/cron.allow/etc/cron.deny
Similar to AT
Thank you for reading! About "linux how to make planning tasks" this article is shared here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!
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.