start multiples processes

Michael Biebl mbiebl at gmail.com
Sat Apr 21 00:15:34 BST 2007


2007/4/21, Mildred <ml.mildred593 at online.fr>:
>
> I'm tryint to replace my Arch init system with upstart. And I have to
> translate an init script that spawn multiples processes. it is ifplugd.
> It monitor the status of the interface (when the wire is un/pluged).
> The current init script spawn as many ifplugd daemons as network
> interfaces.
> I just want to know it is possible to do the same with upstart ...


I would use the "instance" keyword and spawn a separate ifplugd job
for each device.
It could be triggered by udev events.

Add a udev rule like:
SUBSYSTEM=="net", ACTION=="add", RUN+="/sbin/initctl emit
network-device-added %k -eDEVNAME=%k"
SUBSYSTEM=="net", ACTION=="remove", RUN+="/sbin/initctl emit
network-device-removed %k -eDEVNAME=%k"

and the upstart job could look like:

start on network-device-added
stop on network-device-removed
stop on shutdown

exec ifplugd $1
respawn
instance


I haven't actually tested this, but I guess you get the idea.

Michael
-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?



More information about the upstart-devel mailing list