I have a golang script I want to always be running, and it should restart on reboot.
I have a corresponding gopush.conf
file in /etc/init/
:
start on filesystem or runlevel [2345]
stop on runlevel [!2345]
setuid doe
setgid doe
respawn
respawn limit 5 2
exec /home/doe/test
I type sudo service gopush start
and it begins running beautifully.
If I type sudo reboot
, then ssh back in, and type sudo service gopush status
it is always set to stop/waiting
.
What am I doing wrong here? Why won't it start? I thought that's what the start on...
line did?
Did you try removing the filesystem
from the start on
line?
Try using:
start on runlevel [2345]
Also, it will help, if you can mention which version of Ubuntu, you are using.
我start on startup
时使用start on startup
并stop on shutdown
并且在 RedHat 6.8 上工作正常。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.