In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you how the Linux system to view scheduled tasks, the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor to take you to study and learn "Linux system how to view scheduled tasks" this article.
Crontab-l means to list all scheduled tasks crontab-r means to delete the scheduled tasks of the user. When this command is executed, all the scheduled tasks below the user will be deleted. After executing crontab-l, the user will be prompted: "no crontab for admin"
Each line in the file contains six fields, the first five of which are the specified time when the command is executed, and the last is the command to be executed.
Each field is separated by spaces or tabs. The format is as follows:
Minute hour day-of-month month-of-year day-of-week commands
What day of the month, what day of the month, what day of the week is required to be carried out?
Legal value 00-59 00-23 01-31 01-120-6 (0 is sunday) commands (representing the script to be executed)
In addition to numbers, there are several special symbols, namely ",", "/" and "-", which represent all the numbers in the range of values, "/" means each, "/ 5" means every five units, "-" represents from a certain number to a certain number, "separates several discrete numbers.
The line in the crontab file consists of six fields, separated by spaces or the tab key. The first five fields specify the time minutes (0-59) hours (0-28) dates (1-31) months (1-12) days of the week (0-6) where 0 represents Sunday) the sixth field is a string to be executed at the appropriate time
A few examples:
Execute every five minutes: * / 5 *
Execute once an hour: 0 *
Execute once a day: 0 0 *
Execute once a week: 0 0 * 0
Execute once a month: 0 01 * *
Once a year: 0 0 1 1 *
6: 00 every morning
0 6 * echo "Good morning." > / tmp/test.txt / / Note simple echo, no output can be seen on the screen, because cron email any output to the mailbox of root.
Every two hours
0 * / 2 * echo "Have a break now." > > / tmp/test.txt
Every two hours and 8 a.m. between 11:00 and 8 a.m.
0 23-7 echo 8 * echo "Have a good dream" > > / tmp/test.txt
11:00 on the 4th of every month and from Monday to Wednesday
0 11 4 * 1-3 command line
January first at four o'clock in the morning
0 4 1 1 * command line SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root / / if there is an error or there is data output, the data will be sent to this account HOME=/ by email
Execute scripts in / etc/cron.hourly every hour
01 * root run-parts / etc/cron.hourly
Execute scripts in / etc/cron.daily every day
02 4 * root run-parts / etc/cron.daily
Execute scripts in / etc/cron.weekly weekly
22 4 * 0 root run-parts / etc/cron.weekly
Execute the scripts in / etc/cron.monthly every month
42 4 1 * * root run-parts / etc/cron.monthly
Note: "run-parts" this parameter, if you remove this parameter, you can write the name of a script to run instead of the folder name.
Execute the command at 5 min, 15 min, 25 min, 35 min, 45 min, 55 min at 4: 00, 5: 00, and 6: 00 p.m.
5 command, 15, 25, 35, 45, 55, 16, 17, 18, and
The system goes into maintenance state at 3:00 every Monday, Wednesday and Friday, and restarts the system.
00 15 * * 1Jing 3Jing 5 shutdown-r + 5
Execute the innd/bbslin instruction in the user directory at 10 minutes and 40 minutes per hour:
10pr 40 * innd/bbslink
Execute the bin/account instruction in the user directory at 1 minute per hour:
1 * bin/account
Execute the following two instructions (each separated by;) in the user directory at 03:20 every morning:
20 3 * (/ bin/rm-f expire.ls logins.bad;bin/expire$#@62;expire.1st)
The / bin/rm-f expire.1st directive is executed at 03:12 and 03:55 from January and April 4 to 9, and the result is added to the mm.txt file (the mm.txt file is located in the user's own directory location).
12 bin/rm 55 3 4-9 1 pm 4 * / bin/rm-f expire.1st$#@62;$#@62;mm.txt
What is Linux system Linux is a free-to-use and free-spread UNIX-like operating system, is a POSIX-based multi-user, multi-task, multi-threaded and multi-CPU operating system, using Linux can run major Unix tools, applications and network protocols.
The above is about "how to check scheduled tasks in Linux system". If this article is helpful to you and think it is well written, please share it with your friends to learn new knowledge. if you want to know more about it, please pay more attention to 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.
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.