In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to use crontab in Linux system. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Scheduled task is a common way for Linux operation and maintenance personnel, which can help operators reduce a tedious work. In Linux system, crontab is a timing execution tool under linux, which can run jobs without human intervention.
Cron introduces that we often use the crontab command is the abbreviation for cron table, it is the configuration file of cron, you can also call it job list, we can find the relevant configuration files in the following folder.
/ var/spool/cron/ directory stores crontab tasks for each user, including root, and each task is named after the creator
/ etc/crontab this file is responsible for scheduling various management and maintenance tasks.
The / etc/cron.d/ directory is used to hold any crontab files or scripts to be executed.
We can also put the script in the / etc/cron.hourly, / etc/cron.daily, / etc/cron.weekly, / etc/cron.monthly directory and have it executed every hour, day, week, and month.
Our common commands for using crontab are as follows:
Crontab [- u username] / / omit the user table means to operate the current user's crontab-e (edit worksheet)-l (list the commands in the worksheet)-r (delete work) We use crontab-e to enter the current user's worksheet editing, which is a common vim interface. Each line is an order.
The command of crontab is composed of time + action, which can be divided into minutes, hours, days, months and Fridays, and the operators are
* all numbers in the value range
/ how many digits per pass
-from X to Z
, hash number
Instance 1: execute myCommand * myCommand instance 2: execute 3Magne15 * myCommand instance 3 at the 3rd and 15th minutes of every hour: execute 3Magne158-11 * myCommand instance 4 at the 3rd and 15th minutes from 8 a.m. to 11:00 every two days: from 8am to 11:00 3rd and 15th minutes MyCommand instance 5: every Monday from 8am to 11:00 in the 3rd and 15th minutes, execute 3GI 15 8-11 * * 1 myCommand instance 6: restart smb 30 21 * / etc/init.d/smb restart instance at 21:30 every night 7: 1 per month, Restart smb 45 4 1 at 4: 45 on October 22nd / etc/init.d/smb restart instance 8: every Saturday, Restart smb 10 1 * * 6 smb 0 / etc/init.d/smb restart instance 9: restart smb 0 * / 1 * every 30 minutes between 18: 00 and 23: 00 every day 10: 00 pm restart smb 0 23 * * 6 / etc/init.d/smb restart instance 11: restart smb 0 * / 1 * every Saturday at 11: 00 pm / etc/init.d/smb restart instance 12: between 11:00 and 7: 00 a.m. Restart smb 023-7 etc/init.d/smb restart every other hour. Thank you for reading! This is the end of the article on "how to use crontab in Linux system". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
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.