In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
1Query crond scheduled task is a function of Linux system that supports extensible automatic execution of commands or scripts.
1Jing yum provides crond (view the source of the command package)
2, system scheduled task directory file
Crond.hourly-system scheduled tasks run every hour this directory file crond.daily-system scheduled tasks run every day this directory file crond.weekly-system scheduled tasks run weekly this directory file crond.monthly-system scheduled tasks run every month This directory file cond.deny-the system prohibits some users from using scheduled task crontab-scheduled task profile
two。
Crontab-l view the list of current scheduled tasks
Crontab-e Editing scheduled tasks
/ var/spool/cron/root root scheduled tasks written by users will automatically generate root scheduled task files in this directory
/ var/spool/cron/ regular user name scheduled tasks written by ordinary users will automatically generate ordinary user name timing task files in this directory
Systemctl status crond
Systemctl start/stop crond
/ var/log/cron scheduled task logging
3.vi/etc/crontab takes effect globally
Time-sharing, day, month and week
What do you do at 08:30 every day?
What do you do at 12:00 every morning?
/ 10 9-18 1-5 what do you do every 10 minutes from 9 p.m. to 18:00 every Monday to Friday
/ 5 9, 10, 10, 18 * what do you do every five minutes at 18:00, 9: 10?
For example 1, the / etc directory is packaged and backed up under / tmp at 1 o'clock every morning, and the file name is required to be different every day (in order to show the experimental effect immediately, crond writes every minute)
DATE=date +% F
Cd /
Tar-zcvf $DATE.tar / etc & & cp $DATE.tar / tmp/
Note: there are two paths identified by commands executed in scheduled tasks: / bin/ / usr/bin. If some commands cannot be executed, write the absolute path (which view the absolute path) java environment variable problem, write the environment variable to the / etc/profile file
Example 2, create a directory with the name of ip address, package / etc and back up to the ip address name directory, with different names every day
Troubleshooting: ip add needs full path to write in scheduled tasks. Otherwise, the script can be recognized and executed, but not the scheduled task.
Note: there is often a need to create directories or files based on dates for ease of memory in the build environment. Commands that display time and date are important.
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.