At command and crontab command

Source: Internet
Author: User

Today I saw at the command and Crontab command, summed up, but also back down the things in their brains to form a whole understanding.

First, at command

This command is used to perform a routine task, such as I want to specify a point in time to save the files in a directory.

/etc/at.allow/etc/at/at.deny These two files determine whether you can use the AT

1, first check whether the AT command is turned on, some do not open

Service ATD Status

If the display running is OK, if it is not turned on, manually open the

Service ATD Start

2, at the start, can write their own task to lazy

Format: at now + time

For example: at now + 5 minutes (Hours/days/weeks)

Or specify the time directly

At 4pm

Ctrl+d end input after command completion

3, the task is finished, want to see if it is successful,

Atq

such as: Sat Apr 21:21:00 a root

4, if the task is not appropriate, then you can delete

ATRM Jobnumber

The jobnumber here is ATQ query out the task number.

Example: ATQ 24

After you delete it, you can use ATQ to see it again.

Second, the cycle of work crontab (Ubuntu environment)

1, first confirm whether crontab open

Service Cron Status

If the running is OK, use service cron start

2. Then the command format is understood

Minute hour day month week script/command

A total of 6 fields, not sure when the execution will write "*"


Like what:

Execute once per minute: * * * * * Scripts/commands

This is the default format.

Every hour: * */1 * * * Script/Command

crontab Command parameters:

-U user

-l lists the user's crontab tasks specified by-U or the users ' tasks

-R Deletes the user's crontab task specified by-U or the task

-e Edit-u specified user's crontab task or task

3. Editing tasks

Crontab-e

Open the crontab file and edit it on the line

After the task is edited successfully, save the rollout and then show crontab:installing new Crontab
4. View Tasks
Contab-l

5. Delete a task

Crontab-r

-e,-r,-l can be combined with-u to provide root to manage other users ' crontab commands


At command and crontab command

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.