Monday, May 6, 2013

Using upstart in Ubuntu linux

Use the following command to print a list of  the known jobs and instances and to output the status of each to standard output:

user@mycomputer:~$ initctl list
user@mycomputer 


The output is like the following:
...
smbd start/running, process 988
tty5 start/running, process 1260
failsafe stop/waiting
hybrid-gfx stop/waiting
modemmanager start/running, process 1091
rfkill-store stop/waiting
atd start/running, process 1461
dbus start/running, process 612
ecryptfs-utils-restore stop/waiting
failsafe-x stop/waiting
mounted-var stop/waiting
plymouth stop/waiting
resolvconf start/running

...


Let us check and change the status of the job/process mediatomb :


user@mycomputer:~$ ps -el |grep media

4 S 124 1878 1 0 80 0 - 30849 futex_ ? 00:00:00 mediatomb

user@mycomputer:~$ start mediatomb

start: Rejected send message, 1 matched rules; type="method_call", sender=":1.120" (uid=1000 pid=6722 comm="start mediatomb ") interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply="0" destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init")

user@mycomputer:~$ sudo start mediatomb

start: Job is already running: mediatomb

user@mycomputer:~$ sudo status mediatomb

mediatomb start/running, process 1878

user@mycomputer:~$ sudo stop mediatomb

mediatomb stop/waiting

user@mycomputer:~$ ps -el |grep media

(no output displayed because there is no mediatomb process active!)

user@mycomputer:~$ sudo status mediatomb

mediatomb stop/waiting

user@mycomputer:~$ sudo start mediatomb

mediatomb start/running, process 6740

user@mycomputer:~$ ps -el |grep media

4 S 124 6740 1 2 80 0 - 30849 futex_ ? 00:00:00 mediatomb

Good reference articles are the following:
Upstart - Getting Started
What's the recommended way to enable / disable services?

No comments:

Post a Comment