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?
.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)
exec line or
end script block with shell commands to start the actual command.
For example, see the
$ 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  and not-container
stop on runlevel [!23]
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?
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.