23

I'm working on moving my current server setup to newer hardware, and migrating from ubuntu karmic koala to lucid lynx. Currently i'm using gw6c (compiled from the gogo6 website, as opposed to the version from the repositories) to get ipv6 access for my systems. On the karmic koala system, i used simple init.d script to get the ipv6 client started

 #! /bin/sh
/usr/local/gw6c/bin/gw6c -f /usr/local/gw6c/bin/gw6c.conf

I figured since this runs at any runlevel, it should translate to

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

this works fine started from initctrl, but it apparently fails to start when it boots. - its status being stop/waiting. It works fine (and respawns) when started otherwise.Any ideas on where i'm going wrong, and what would be the appropriate 'start on' arguement?

EDIT: the exact error is 'init: gw6c main process (xxx) ended with status 8' followed by the process respawning , with xxx being a PID i suspect. I'm also half suspecting this is cause gw6c starts before networking does, and i need my eth0 up before gw6c is

Journeyman Geek
  • 6,969
  • 3
  • 31
  • 49

4 Answers4

27

Apparently

respawn
console none

start on (local-filesystems and net-device-up IFACE!=lo)
stop on [!12345]

script
chdir /usr/local/gw6c/bin/

exec /usr/local/gw6c/bin/gw6c 
end script

seems to work

Ori
  • 103
  • 3
Journeyman Geek
  • 6,969
  • 3
  • 31
  • 49
4

Place a script starting gw6c in

/etc/network/if-up.d

All scripts in that folder get run after an interface comes up. If you only want it run when eth0 comes up then edit the eth0 entry in

/etc/network/interfaces

and add a call to the script

iface eth0 inet dhcp
  up /etc/init.d/gw6c restart

I would also suggest adding pre-down scripts to shutdown the tunnel before the interface goes offline.

Once you do that and find an implementation that works, post it back here so I can use it. I've got gw6c on my laptop but I have been thus far to lazy to automate it.

Haakon
  • 1,305
  • 7
  • 11
  • The former script i posted works pretty well- though i need to manually restart it, should my connection reset itself- this is for upstart, which is default on lucid lynx. – Journeyman Geek Feb 28 '10 at 09:00
1

Thank you "The Journeyman geek" :) You saved me a lot of time. I was fighting with /etc/init.d/gw6c script, trying some timings with "sysv-rc-conf -p" and wondering why it is not working (aka WTF?).

respawn
console none

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

script

exec /etc/init.d/gw6c start
end script

Slightly modified ("runlevel" and exec command) script did the job! :) :) :)

0

From here: http://upstart.ubuntu.com/cookbook/#single-job-instance-running-without-pid

description     "Uncomplicated firewall"

# Make sure we start before an interface receives traffic
start on (starting network-interface
          or starting network-manager
          or starting networking)

stop on runlevel [!023456]

console output

pre-start exec /lib/ufw/ufw-init start quiet
post-stop exec /lib/ufw/ufw-init stop
Matt Sweeney
  • 249
  • 2
  • 7