In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
First, check whether the cron package is installed:
Rpm-qa | grep cron
2. Confirm whether the crond service is set to boot
Service crond status starts and shuts down levels 3 and 5 crond service chkconfig-- level 35 crond onchkconfig-- level 35 crond off
III. Crond configuration files and log files
Use the crontab-e command to customize the task schedule for the current user, which generates files to / var/spool/cron/$USER
The crond service scans all files in the / var/spool/cron directory every minute to execute the instruction information in the file.
Fourth, prepare the crontab task plan
Crontab file format
Execute orders in time, day, month and week
Case: execute the script every 10s
* / 1 * sleep 10s & & script.sh*/1 * sleep 20s & & script.sh*/1 * sleep 30s & & script.sh*/1 * sleep 40s & & script.sh*/1 * sleep 50s & & script.sh
Note: here these five will start at the same time, so the script will be executed every 10s.
Example:
Execute touch / tmp/a.txt at the 10th minute of every hour
10 * touch / tmp/a.txt
Execute at intervals of 10 minutes
* / 10 * touch / tmp/a.txt
Executed at 10: 30 every night.
30 22 * touch / tmp/a.txt
The 30th minute from 8pm to 10:00 every day.
30 20-22 * touch / tmp/a.txt
Implemented at 10: 30 on January 1 every year.
30 10 1 1 * touch / tmp/a.txt
Execute every two hours
0 * / 2 * echo "Have a break now." > > / tmp/test.txt
First check the crond log:
There are two situations.
First: the mission plan was not carried out at all.
1) restart the crond service.
2) determine whether the task schedule run time is written correctly and whether it is the time we want to execute
Second: the task plan was executed and the called script went wrong.
1) permission issue, whether the file or user has the right to execute
2) relative path absolute path problem in script
3) variable problem of script
4) the path was written incorrectly in the task plan, so that the script was not called at all
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.