In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
The main content of this article is to explain "the example steps of Linux scheduled tasks". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "Linux timed task example steps" it!
Catalogue
General steps for 0x01
0x02 instance
General steps for 0x01
Usually take a few steps when making scheduled tasks, in order to avoid errors
1. Command line operation, first make sure that the command can be executed under the command line
two。 Script production, generally all the operation commands are written as scripts for operation.
3. Test the script to make sure the script is executed correctly
4. Configure the scheduled task and make the final scheduled task
0x02 instance
Backup / etc/hosts,/etc/rc.local,/var/spool/cron/crontabs/root files, backed up to / root in the form of a compressed package, required to be backed up once a day, every morning at 03:15
Here is a sentence / var/spool/cron/crontabs/root, which stores the contents of root's planned tasks.
Let's execute it at the command line first.
Let's start with a practice that is not recommended.
If it is packaged in this way, it will be directly placed in the root directory when it is decompressed, so it is usually cd to the upper directory of all the packaged files, and then packaged.
Next, test the script.
Finally, write it to the scheduled task.
If the scheduled task goes wrong, you can check it in the log of the scheduled task.
However, it should be noted that Debian does not enable cron logging by default, so you need to remove comments from / etc/rsyslog.conf.
You can see the log of the execution.
There are several situations that are prone to failure, so pay attention to it when setting it up.
1. If the & > / dev/null is not added at the end when setting a scheduled task, it may produce a large number of files and take up a lot of inode
two。 If executed directly on the command line, date +% F will have a problem. The% sign must be escaped, so it is recommended to run it in the script.
3. If there is an environment variable in the scheduled task script, it must be redefined. If the environment variable is set in profile, the undefined situation will still occur when the task is scheduled, so be sure to rewrite the environment variable in the script file first.
At this point, I believe that you have a deeper understanding of the "Linux timed task example steps", might as well come to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.