I have an upstart script in /etc/init/myexample.conf
. This job basically runs a java jar file. Normally, I can start and stop this using sudo start myexample
and sudo stop myexample
.
I changed the jar file and introduced an error that caused the jar to crash. After starting the jar with sudo start myexample
, I see the errors in my log file.
Now I would like to stop the upstart job and replace the jar file with a working one again. I have seen two scenarios:
sudo stop myexample
hangs indefinitely (at least 10 minutes). I also cannot start the job again withsudo start myexample
, I receive the errorstart: Job is already running: myexample
.sudo start myexample
hangs indefinitely, andsudo stop myexample
givesstop: Job has already been stopped: myexample
.
I can also run the jar manually from the command line.
pgrep -lf myexample
and pgrep -l myexample
return nothing. pgrep -l java
shows other java processes that are running, but not the failed one corresponding to myexample. Upstart thinks the process is running, but it is not.
How can I get the upstart job running again, without a reboot?
/etc/init/myexample.conf
:
description "myexample"
start on runlevel [2345]
stop on shutdown
respawn
respawn limit 3 120
expect daemon
setuid exampleuser
script
chdir /home/exampleuser/
java -jar /home/exampleuser/example.jar
end script