Linux Routine Task management

Source: Internet
Author: User

If the task is to be executed periodically, use cron
If a task executes only once in a particular practice, use the at
[email protected] grub.d]# which shutdown
/usr/sbin/shutdown
[Email protected] grub.d]# at now + minutes #设置从现在开始30分钟后关机
At>/usr/sbin/shutdown-h Now
At> <EOT>
Job 4 at Mon Jul 30 16:54:00 2018
[Email protected] grub.d]# ATQ #查看任务列表
4 Mon Jul 16:54:00 2018 a root
[Email protected] grub.d]# ATRM 4 #删除定时任务
[Email protected] grub.d]# ATQ
[Email protected] grub.d]#
You can also define a detailed date time to execute
[[email protected] grub.d]$ at 01:00 2018-08-02
At>/usr/sbin/shutdown-h Now
At> <EOT>
Job 6 at Thu 2 01:00:00 2018
[Email protected] grub.d]$ ATQ
6 Thu 2 01:00:00 2018 a Liuyu
By default, everyone can use the AT command to dispatch their own tasks, and if you want to disable this feature for some users, add the user's username to/etc/at.deny.

When you execute cron, check to see if the Crond process is running

Users can set their own scheduled tasks through the crontab command, and the-e parameter to edit the task in B.
Format to execute the command
The first 5
good is to define the time, in order: minutes, the value 1-59, the hour, the value 0-23; date, value 1-31; month, value 1-12; Day of the week, value 0-6;
After setting the time, follow the command you want to execute.

You can use Crontab-l to view the set of tasks
You can delete all tasks by using Crontab-r
Each user can set their own scheduled tasks, if you want to prohibit a user, the user name is added to/etc/cron.deny
Root users can view other users ' scheduled tasks
Crontab-u zhangsan-l
View System routine Tasks/etc/crontab
[[Email protected] etc]# CD cron.
cron.d/cron.daily/cron.hourly/cron.monthly/cron.weekly/

Linux Routine Task management

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.