Linux crontab timed execution of script notes

Source: Internet
Author: User

Because Linux to run the Coreseek script files regularly and used to crontab, found some use to pay attention to the place:

1. Common commands

Service Cron start cron Service

Service Cron Stop cron Service

Service Cron Reload does not stop the condition of the services downloaded into the crontab configuration file

Service Cron Restart Restart Cron Service

Crontab-e is to edit the crontab configuration file, here is a problem, run this command after the default editor nano, will make people very unaccustomed, run Select-editor, select Vim.basic, run CRONTAB-E command again, The Vim editor is in.

The last line fills in the scheduled execution task to be configured by Crontab, in the form:

minute: Minute, value is 0-59

Hour: Hour with a value of 1-23

Day: Days with a value of 1-31

Month: The value is 1-12

Weekday: Week, value 0-6 (0 for Sunday, 1 for Monday, etc.)

Command: Program path to execute (set to absolute path) for example:/bin/sh/usr/local/coreseek/init/classes.sh

If you want to do it every few seconds, press the online method */30 * * * */bin/sh/usr/local/coreseek/init/classes.sh >/dev/null 2>&1 execution is invalid, only with sleep resolution As follows:

* * * * * * sleep 30; /bin/sh/usr/local/coreseek/init/classes.sh >/dev/null 2>&1.

The./dev/null 2>&1 is to place standard output and error handling in the Recycle Bin.

After editing the configuration file, Wq Save, and then service crontab reload reload the profile, and restart Crontab Services service crontab Restart so that the scheduled task configuration is complete.

Linux crontab timed execution of script notes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.