In centos 6.8 I have a golang app , that run in command go run main.go
and I need to create a system service to run it in boot like service httpd.
I know that I have to create file like /etc/rc.d/init.d/httpd
But I don't know how to do it to run that command.
1 Answer
If no script exists anywhere for your app then have a look on your system for the following file;
sysvinitfiles
on my Centos 6.8 system its located at /usr/share/doc/initscripts-9.03.53/
but if you do a locate
you should find it.
It's a skeleton script that you can copy, modify then use for most things. Once you get it configured you can use it via chkconfig
as you would any other init script.
There are a couple of good websites which may help here and here.