[Ubuntu-SG] upstart help?

Chow Loong Jin hyperair at gmail.com
Sun Feb 28 06:50:50 UTC 2010


On Sunday 28,February,2010 06:55 AM, Ravi Mohan wrote:
> I'm currently planning on setting up lucid lynx on my new personal
> server. On my old one, i'm using init.d to start my ipv6 tunnel provider
> - (gogo6/free6 - they're the only one that'll work behind a nat, and
> work in singapore ;p). I'm trying to set up a similar setup with upstart
> (which has some advantages - such as restarting the script if it goes down).
> 
> at the moment i can invoke this from command line- i want it to
> automatically start after my networking is up, but before apache would-
> as is, i think it starts before netwowking does. Can someone tell me
> what i need to change?
> 
> respawn
> console none
> 
> start on startup
> 
> stop on shutdown
> 
> script
> exec /usr/local/gw6c/bin/gw6c -f /usr/local/gw6c/bin/gw6c.conf
> emit free6_ipv6_started
> end script
> 
> 

start on (local-filesystems and net-device-up IFACE=eth0)
stop on runlevel [!2345]

!2345 means all the multi-user modes. If you want it to run in single-user mode
as well, then use !12345.

As for your script, you don't need to emit that event, as there will be an event
"started <your-service-name>" event emitted automatically. Just drop the
"script" and "end script" lines and you are good to go. I don't think you need
to put the "console" line either.

Also, if your service does the double-fork-to-background thing, put an "expect
fork" line or init will do a fork bomb for you as it thinks your service has
terminated/finished.


`man 5 init` for more information.

-- 
Kind regards,
Chow Loong Jin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-sg/attachments/20100228/1337c6ec/attachment.sig>


More information about the Ubuntu-SG mailing list