Use crontab in Linux to implement program robustness

Source: Internet
Author: User
Introduction: you can use the crontab command to modify the crontab configuration file, which is then executed by the cron utility at an appropriate time. The permission to use this command is

Introduction:

You can use the crontab command to modify the crontab configuration file, which is then executed by the cron utility at the appropriate time. The permission to use this command is for all users.

General format:

Crontab [-u user] {-I |-r |-e}

-I: list the current time tables.

-R: generate the current time table

-E run the text editor to set the time table.

Crontab file format: "m h d m d cmd"

Corresponding to minutes, hours, days, months, and the sh program to be executed.

Therefore, crontab can be used to regularly execute a program, which increases the robustness of the program.

Example:

There is a/home/code/print. sh:

#! /Bin/sh

Echo "Hello! "

Edit the/etc/crontab file and add a line at the end:

30 * root/home/code/print. sh

This means that print. sh is run every 30 minutes with the root user.

If you have reprinted the results of your hard work, please indicate the source. thank you!

Related Article

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.