About RHEL6 server time task

Source: Internet
Author: User
Script Service Management/etc/init. d/and/etc/rc. d/init. d directory store all the service startup scripts [root @ rootbug ~] # Vim/etc/init. d/httpd #/bin/bash -- defines the script to be parsed by bash # chkconfig:-8515 # description: ApacheisaWorldWideWebserver. Itisusedt

Script Service Management
The/etc/init. d/and/etc/rc. d/init. d directories store the service startup scripts.

[Root @ rootbug ~] # Vim/etc/init. d/httpd
#/Bin/bash
-- Define scripts parsed by bash
# Chkconfig:-85 15
# Description: Apache is a World Wide Web server. It is used to serve \
# HTML files and CGI.

For a service script, there are generally two lines of comments below
# Chkconfig:-85 15
-If there is no number, only one pole indicates that the service is not started when it is started, use chkconfig -- list | grephttpd to get all results off. If there is a number, such as 2345, indicates that the data in/etc/rc2.d/--- to/etc/rc5.d/is marked as start-up. The start sequence is shown in the next number, that is, 85; the data in/etc/rc1.d/and/etc/rc1.d/is marked as disabled. The closing order is followed by a number, that is, 15.
85 indicates that the sequence number for starting the instance is 85.
15 indicates that the service is shut down with a sequence number of 15


The graphic configuration service is automatically started or disabled upon startup.
Command description ntsysv-simple interface for logging ing runlevels

Ntsysv
You can configure ntsysv to enable or disable services required by the server.


Time script task
General time tasks include at (batch), atd, crond, and anacron.
/Etc/init. d/atd
/Etc/init. d/crond
/Etc/init. d/anacron

At
-L viewing the time job is equivalent to atq
-D: The deletion time job is equivalent to atrm.
-C: display the time job content
-F is followed by a script
Script Execution
[Root @ rootbug ~] # Vim 1.sh
#! /Bin/bash
Echo "12345">/dev/pts/2

[Root @ rootbug ~] # At 031711-f 1.sh
Job 8

Execute directly with
[Root @ rootbug ~] # At 031711
At> echo "hello">/dev/pts/2
At> -- ctrl + d
Job 2

There is also a similar way of writing over time below
[Root @ li ~] # At now + 10 minutes
[Root @ li ~] # At now + 1 hours
[Root @ li ~] # At now + 1 days
[Root @ li ~] # At now + 1 weeks
[Root @ li ~] # At now + 1 months
[Root @ li ~] # At now + 1 years

* ** How can I restrict the use of the at command to deny certain users?
Restrictions on the Use of at tasks:
/Etc/. allow -- here you can write a common user that allows at execution (the format should also be noted, do not mess up spaces), a single user line; if it exists, you don't have to consider. deny
/Etc/at. deny -- here, you can decide to reject normal users who execute at, one row of users; if at. allow does not exist, it takes effect.

Related reading:

Ubuntu timing task http://www.linuxidc.com/Linux/2009-10/22389.htm with crontab

Linux Crontab timing task http://www.linuxidc.com/Linux/2013-03/81543.htm

Crontab timing task notes http://www.linuxidc.com/Linux/2012-08/67848.htm in Linux

Scheduled Task Scheduling in Linux-crontab command http://www.linuxidc.com/Linux/2012-07/66510.htm


For more details, go on to page 1: http://www.linuxidc.com/Linux/2013-09/89820p2.htm

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.