1

Where can I read some brief information about upstart in ubuntu?
I found "Upstart Intro, Cookbook and Best Practises", but it's too big.

How can I add my own service?
What's the difference between /etc/init and /etc/init.d in Ubuntu?
Will Ubuntu move to systemd initialization in future?
Is service command deprecated?
Why some files in /etc/init.d contains these lines:

# Don't run if we are running upstart
if init_is_upstart; then
    exit 1
fi

It seems that Ubuntu has 2 different initialization systems. Am I right?

3

Where can I read some brief information about upstart in ubuntu?

The Upstart Getting Started page might be useful (just skip to the Writing Jobs section). Or the DigitalOcean tutorial.

How can I add my own service?

Bare basics:
Create a .conf file in /etc/init. It should have:

  • A valid start on stanza (and if it is a service instead of a short-lived task, a valid stop on stanza)
  • An exec line or script-end script block with shell commands to start the actual command.

For example, see the tty5 service:

$ cat /etc/init/tty5.conf 
# tty5 - getty
#
# This service maintains a getty on tty5 from the point the system is
# started until it is shut down again.

start on runlevel [23] and not-container

stop on runlevel [!23]

respawn
exec /sbin/getty -8 38400 tty5

What's the difference between /etc/init and /etc/init.d in Ubuntu?

The former is for Upstart service configuration files, the latter for the older sysvinit scripts.

Will Ubuntu move to systemd initialization in future?

Yes.

Is service command deprecated?

Not so far. service covers both Upstart and sysvinit services. I'm not sure what form it will take in 15.04.

Why some files in /etc/init.d contains these lines: ...
It seems that Ubuntu has 2 different initialization systems. Am I right?

No, Ubuntu has only one init system: Upstart. Upstart can load and run sysvinit services. The creators of some packages provide both Upstart and sysvinit service files, since the packages maybe used in a system without Upstart (such as an older version of Debian). This way, the package creator doesn't have to provide two packages for both init systems. If the Upstart service is running, the sysvinit service shouldn't be, which is why that check is in place.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.