Brief description of Upstart event-driven tasks and Service Guidance Methods

Source: Internet
Author: User

/********************************************************************* * Author  : Samson * Date    : 04/30/2014 * Test platform: *              3.11.0-12-generic #19-Ubuntu *              GNU bash, version 4.2.45 * *******************************************************************/

Upstart is an event-based alternative to the/sbin/init daemon that processes tasks and services during the boot process.


The process ID (PID) is "1" during "initialization" or "system initialization" on Unix and Linux systems ". That is to say, it is the first process to start loading at system boot (ignored initrd/initramfs. According to the official statement, Upstart is an "init" System that replaces the traditional Unix "System V ". Upstart provides the same functions as the traditional "initialization" system, but beyond the original many aspects.

If the Upstart mode is used, many of the systems under/etc/init/will be executed during startup. conf file, which contains the execution method of the service or task. These files use the Upstart-based event method, such as ssh. conf, which is the configuration file for starting the Upstart event of the ssh service. The details are as follows:

# Ssh-OpenBSD Secure Shell server
#
# The OpenSSH server provides secure shell access to the system.

Description "OpenSSH server"

# Indicates that the Service (sshd) is started when the logon interface is executed.
Start on desktop-session-start
# The meaning of the following sentence is that when the system is in the four startup modes of 2, 3, 4, and 5 or when the file system event Signal
# Start on filesystem or runlevel [2345]
Stop on runlevel [! 2345]
# When the service or program is stopped, restart the service to ensure service continuity.
Respawn
# Maximum interval of rebirth count | Unlimited
# Syntax:
# Respawn limit count interval | unlimited
# The following statement indicates that the maximum number of restarts is 10, and the interval is 5 seconds.
Respawn limit 10 5
Umask 022

# 'Sshd-d' leaks stderr and confuses things in conjunction with 'console Log'
Console none
# Pre-start:
# Syntax:
# Pre-start exec | script
# Blocks pre-processed before a task is executed
# The following describes whether the sshd Executable File sshd_not_to_be_run exists.
Pre-start script
Test-x/usr/sbin/sshd | {stop; exit 0 ;}
Test-e/etc/ssh/sshd_not_to_be_run & {stop; exit 0 ;}
Test-c/dev/null | {stop; exit 0 ;}
# The execution time can be printed here;
Echo "'date' is start.">/home/leukocyte/sshdatatime. log
# Modify sshd Permissions
Mkdir-p-m0755/var/run/sshd
End script

# If you used to set SSHD_OPTS in/etc/default/ssh, you can change
# 'Exec 'line here instead
Exec/usr/sbin/sshd-D

Upstart reference:
Http://upstart.ubuntu.com/cookbook/#what-is-upstart


After the system is restarted, the Service start time is the time after the logon interface is started, instead of starting the service as soon as the system starts;

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.