Shell Background Execution Command-crontab

Source: Internet
Author: User

Noun Explanation:

Cron system scheduling process that can run jobs at a certain time interval or at a fixed point in time

& Use it to run a process that takes a long time in the background

Note:

Cron is a system scheduling process that can run a job without intervention, allowing the user to submit, edit, or delete the corresponding job through crontab commands.

Each user has a crontab file to hold job scheduling information and run any shell script or command from this command

In large systems, system administrators can disable or allow users to own their own crontab files through the two files of Cron.deny and Cron.allow.

Crontab format: Time-sharing day and month command to run

* * * * *

Crontab Domain: 1th column min 1-59

2nd Column Hour 1-23 (0 = midnight)

3rd Liege 1-31

4th Column Month 1-12

5th Column Week 0-6 (0 = Sunday)

6th List of commands to run

Command options for Crontab:

Format: crontab [-u user]-e-l-r

-U user Name

-e Edit Crontab file

-l lists the contents of the crontab file

-R Delete crontab file

  • To create a new crontab file:

    Modify the. bash_profile file in the $home directory to add environment variables

    Editor=vi;export EDITOR//NOTE: Re-login after modification

  • Delete crontab file

    $crontab-R

  • Recovery of crontab files

    If you mistakenly delete the crontab file, assume that there is a backup in the $home directory, you can copy the backup file to/var/spool/cron/<username> username is the user name, if the permissions issue cannot be copied, you can use

    $crontab <filename>

    Note:filename is the name of the backup crontab file

  • Restart of crontab

    $crond stop

    $crond start


Shell Background Execution Command-crontab

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.