Process after Linux Study Notes (cron and crontab)

Source: Internet
Author: User

Process after Linux Study Notes (cron and crontab)

. Set the crontab file and use it to submit the job.
. Use the AT command to submit a job
. Submit a job in the background
. Use the nohup command to submit a job

Cron system scheduling process, which is used to run jobs during off-peak hours every day, or run jobs during different periods in one week or one month.
At command to run some special jobs at specific time
& Use it to run a process that takes no longer time in the background
Nohup uses it to run a command in the background, even if the user exits, it will not be affected.

3.1 cron and crontab

Cron is a system scheduling process that runs jobs without human intervention.
The crontab command allows you to submit, edit, or delete a job. Each user has a crontab file to save scheduling information,

3.1.1 crontab Field

1st columns minute 1 ~ 59
2nd columns hour 1 ~ 23
3rd columns, Day 1-31
4th columns Month 1 ~ 12
5th columns in a week 0 ~ 6
6th columns of commands to run

3.1.2 example
30 21 ***/apps/bin/clearnup. Sh
Run cleanup. Sh in the/apps/bin directory at every night.

45 4, 10, 22 **/apps/bin/backup. Sh
Execute backup. Sh in the/apps/bin directory at on November 22 ,.


10 1 ** 6, 0/bin/find-name "core" RM {}/;
Every Saturday. Run a find command

0, 30 18-23 ***/apps/bin/dbcheck. Sh
Every day between and ~ Run dbcheck. Sh in the/apps/bin directory every 30 minutes.

0 23 ** 6/apps/bin/qtrend. Sh
Execute/apps/bin/qtrend. Sh at every Saturday.

3.1.3 crontab command options

Crontab [-u user]-E-l-R

-U User Name
-E: edit the crontab file
-L list the contents of the crontab file
-R: Delete the crontab file.

3.1.4 create a crontab file
Crontab faintbearcron
3.1.5 list crontab Files
Crontab-l

Crontab-L> $ home/faintbearcron
(Backup)
3.1.6 edit the crontab file
Crontab-e
3.1.7 Delete the crontab file
Crontab-R
3.1.8 restore the lost crontab file
Crontab <FILENAME>
<FILENAME> indicates the file name of the copy in the $ home directory.

 

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.