LinuxCrontab use -- scheduled task

Source: Internet
Author: User
You can use crontab to periodically execute scripts. Generally, crontab started in linux can be directly used. first, paste several service commands: sbinservicecrondstartsbinservicecrondstopsbinservicecrondrestartsbinservice.

Preface

To regularly execute scripts, you can use crontab. Generally, crontab is started in linux and can be directly used. first, paste several service commands:

/Sbin/service crond start
/Sbin/service crond stop
/Sbin/service crond restart
/Sbin/service crond reload

If crontab is not enabled, add/sbin/service crond start to the/etc/rc. d/rc. local script.

1. view, edit, and delete scheduled tasks

Each user has his/her own crontab scheduled task. pay attention to whether the script to be executed requires the root permission. if necessary, switch to the root operation.

(1) view

Use crontab-l

(2) edit and delete

Use crontab-e to add tasks like vi. The syntax is described below. You don't need to delete it. you just need to delete it directly.

2. Syntax

Example: 0 0 ***/home/shell/cut_nginx_log.sh

The first part is 0 0 ***. the execution time is minute, hour, day, month, and week. The example is 00:00 every day.

Part 2/home/shell/cut_nginx_log.sh: script to be executed

OK. is that simple? (^ ω ^ )?

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.