Ubuntu uses Upstart
instead of the traditional init
system. Upstart is stronger than init, but it's a little bit more complicated than init
.
Upstart, in contrast, is event based. An "event" can be something like "booting" ... or it can be a lot more specific, like "the network is ready to use now". You can specify which scripts depend on which events. Anything that isn't waiting for an event can run whenever there's CPU available.
This event-based system has another advantage: you can theoretically use it even after the system is up and running. Upstart is eventually slated to take over tasks such as or plugging in external devices like thumb drives (currently handled by udev and hal), or running programs at specific times (currently handled by cron).
As you should know now, a dead daemon (that doesn't run in startup) may be alive and starts because of an event.
Ubuntu have both /etc/init, for Upstart, and /etc/init.d, for the old SysV files. Some of the files in it are regular SysV Init scripts that haven't been migrated yet. But some services that have migrated maintain a link from /etc/init.d to /lib/init/upstart-job. If you run one of those, it works, but it prints a warning first:
Rather than invoking init scripts through /etc/init.d, use the service(8) utility, e.g. service mysql restart
Since the script you are attempting to invoke has been converted to an Upstart job, you may also use the restart(8) utility, e.g. restart mysql.
On an Upstart machine, init comes from upstart. Instead of running a master rc script that calls the scripts for a specific runlevel, Upstart's init takes jobs from its job directory.
Now we know there's no simple way to list autostart daemons, you should list all daemons and check them one by one. The daemon may be started by init
or by upstart
or even by a later event.
The simplest way to get this list is running this command in the shell:
initctl show-config
The output looks like this:
...
hostname
start on startup
udevtrigger
start on ((startup and started udev) and not-container)
tty2
start on (runlevel [23] and ((not-container or container CONTAINER=lxc) or container CONTAINER=lxc-libvirt))
...
Some items like the first one is so simple, hostname
starts on startup. But other items may look more complicated. (But fortunately human readable :-) )
I think
chkconfig --list
will work right?on
means that service is running on that runlevel, and that service will automatically start when the system boot. – max – 2012-11-28T13:07:28.0731As what I posted in my question, chkconfig does not always work. for example, it will give wrong result for mongodb. I think it might because mongodb uses /etc/init/mongodb.conf to do the autostart. – SSS – 2012-11-29T10:01:23.967
How about
ls /etc/rc?.d
? – toxaq – 2013-07-10T12:30:18.177