How to add Upstart event-type tasks to the system under the upstart Mechanism

Source: Internet
Author: User

How to add Upstart event-type tasks to the system under the upstart Mechanism

/********************************************************************* * Author  : Samson * Date    : 11/15/2014 * Test platform: *              3.13.0-24-generic *              GNU bash, 4.3.11(1)-release  * *******************************************************************/
Currently, the system startup mechanism used by LinuxMint is based on ubuntu's upstart. The corresponding configuration file directory is/etc/init. According to upstart, create a configuration file that can start a task directly using initctl emit eventname on the command line, and create the file mytestup under/etc/init. conf. The content is as follows:
Start on mytestyy
Task
Exec/bin/date>/tmp/yygydjkthh

When the event is mytestyy, run the/bin/date command to write the result to the/tmp/yygydjkthh file.

After saving the file, you can restart the system or directly use the command to update the upstart configuration file on the command line to make it take effect:
Sudo initctl reload-configuration

Then run the command to trigger the event on the command line:
Sudo initctl emit mytestyy
The task can be executed: mytestup. Check that/tmp/yygydjkthh already exists, indicating that the task is successfully executed;

Upstart emit principle:

Creates an associated table for all tasks. When an emit event is detected, the table matches the table. If the event name is consistent, the corresponding task or service is executed;


Ref: http://upstart.ubuntu.com/cookbook/#event


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.