5

I have problems with my deamon restart. upstart is not spawning the daemon when the daemon crashes. here is my upstart init file . pls advise.

description "bezkon watch dog"



start on runlevel [2345]

stop on runlevel  [!2345]

respawn

expect fork

script

        logger -s "Bezkon watch dog booting ..."

        logger -s "Waiting for engine to complete booting sleeping for 60 seconds "

        sleep 300

        export PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

        export LUA_PATH=$LUA_PATH:/usr/local/bezkon/

        export LUA_CPATH=$LUA_CPATH:/usr/local/bezkon/

        chdir /usr/local/bezkon;

end script

exec /usr/local/bezkon/bezkon_dog >> /var/log/bezkon_crash.log 2>&1
Ravikumar Tulugu
  • 1,702
  • 2
  • 18
  • 40

1 Answers1

2

I don't think you can use script and exec together. Try pre-start script instead. Or put the exec line inside the script stanza. Not sure how this works together with expect fork though.

EDIT: Take a look at this bug comment by Scott Remnant, the lead Upstart dev. It looks like it would apply to your config file, and it doesn't appear that it has been fixed yet. I still think you might want to try pre-start script, or experiment with expect daemon vs. expect fork vs. nothing. Assuming you haven't done this already, it can't hurt.

Tim Yates
  • 5,151
  • 2
  • 29
  • 29
  • but this script works now and upstart seems to be happy with this. – Ravikumar Tulugu May 17 '11 at 04:27
  • And you're sure your daemon is starting in the first place? If so, what happens when it dies? Any log messages, either in your `bezkon_crash.log` or in the syslog? – Tim Yates May 17 '11 at 04:29
  • i am killing it with kill command and i expect the upstart to restart my daemon. yes my daemon is starting. bezkon_crash.log is just for capturing the stack trace when the daemon crashes. the daemon is written in LUA – Ravikumar Tulugu May 17 '11 at 04:38
  • Okay. I know next to nothing about LUA, so I'm sorry for fumbling around in the dark here. How is your daemon set up to fork? I take it you've checked it without `expect fork` and it doesn't work? – Tim Yates May 17 '11 at 04:49
  • Forget that. Saw your other comment. – Tim Yates May 17 '11 at 04:50
  • Thanks for the pointer Tim , seems i can mine some useful from the mail thread. – Ravikumar Tulugu May 17 '11 at 06:33
  • 2
    It seems some problem with the way i daemonize the processes. I wrote a simple test program in c using the daemon system call to deamonize the process. it seems to work and it gets respawned when i kill the process. still debugging whats wrong with the lua thing. – Ravikumar Tulugu May 17 '11 at 08:55