Inux study notes three-Background Command Execution

Source: Internet
Author: User

1. cron system scheduling process. It is a scheduled execution tool in Shell lunx, which can be used for jobs without human intervention.

$/Sbin/service crond start -- start the crontab Service

$/Sbin/service crond Stop -- stop the crontab Service

$/Sbin/service crond restart -- restart the service

$/Sbin/service crond reload -- reload Configuration

In Linux, the cron service is not enabled by default, and can be enjoyed only after the cron service is started.

Cron provides the crontab command to set the cron service.

Crontab-e -- edit the cron Service

Crontab-r -- delete the cron Service

Crontab-u -- user name. You must have the following permissions: crontab-u user-L.

Crontab-l -- list cron services

Crontab Field

Minute hour day month week command

Value Range: 1-59

Value Range: 1-23 (0 indicates midnight)

Day value range: 1-31

Monthly value range: 1-12

The value range of the week is 0-6. 0 indicates Sunday.

In these domains, you can use "-" to represent consecutive times, use "," to separate region values, or use "*" to represent all values.

The user submits a job to cron. To provide the job to all cron environments, the command must be written in the full path.

For example:

1 *****/bin/ECHO 'date'>/dev/console -- output the current time to the console at every hour

0 0 1 **/myshell/find. Sh -- execute the find. Sh script in the/myshell directory on the first day of each month.

0 06-18 1 1 */myshell/tr. Sh -- run the tr. Sh script in the/myshell directory during the period from January 1

0 0 0 0 1 0 0 2/bin/find-name "*. log"-exec {}\; -- find and delete the log on Sunday and Sunday

Create a new Cron file touch usercron;

Crontab usercron; -- submit a job


 


2

When running the command in the background, the terminal can do other things, but the command running result will be transmitted to the screen, interfering with the work, usually can be located

To a file.

Command Format &

Find-name "*. txt"-print> out. File 2> & 1 & -- this command is used to query files suffixed with TXT and output the query standard.

And the error output are set to the out. File file. After the process is successfully submitted, the corresponding process number will be displayed. We can monitor it or kill it.

Drop

 


3 nohup this command is a background command, even if the user exits, it will not affect

Nohup means no hang up)

Command Format: onhup command &

Nohup find-name "*. txt"-Print &


Inux study notes three-Background Command Execution

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.