2

I've used the below script both with and without expect fork. It's purpose is to start a .exe file on start-up, and if it fails, to restart it. The mono application must be started by root/sudo to work.

What happens:

  • Application Starts and shows Listening to port 8888 in output log
  • Upstart goes into respawn and tries to restart the script despite it already being started
  • An error message per respawn attempt appears in the output log saying that the application is already running
  • After an hour or so, the application fails/stops, and respawn is not triggered

Here is my upstart script:

author "me"
description "hi"

start on local-filesystems
stop on shutdown

console log
respawn
respawn limit 2 5

env DIR=/home/danny
env PATH=/sbin:/usr/sbin:/usr/local/bin:/user/bin:/bin

expect fork
script
    set -x
    /usr/bin/mono /home/danny/path-to-my.exe
end script

Any/all help is appreciated. I'm a little stumped on this one.

1 Answers1

0

since the file is an EXE it is likely that you need a different way of detecting if it is running due to the fact that EXEs are run through wine and so are different than the programs native to ubuntu