respawn on script and exec
Hi,
I have created a working job config file as follow:
start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]
respawn
# a C program loop infinitely that do nothing
exec /some/program/
normal exit 0
When I issue command kill 9 [infiniteLoop.exe pid] it is killed and respawn the inifiniteLoop.exe as it should. I then use this as an example config to make my daemon that required to start at a certain directory so I modified the config as follow:
start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]
respawn
expect daemon
script
cd /path/to/
sudo -u specificUser ./Daemon.exe --arg1 --arg2
end script
normal exit 0
The config can start and stop the job automatically and manually, but when I issue kill 9 [Daemon.exe pid], the daemon is killed without respawn. Am I doing something wrong? The reason I used script instead of exec is that exec started the process from root directory, is it possible to cd to the directory and then perform exec?
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- upstart Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- dyuen
- Solved:
- Last query:
- Last reply:
This question was reopened
- by dyuen