Closed jonlives closed 11 years ago
Hey, what distro specifically is this for? It's not Ubuntu and I don't have a RHEL/CentOS/SL/whatever box nearby to test whether /etc/rc.d/init.d/functions is from that neck of the woods or what.
(Unrelated, you'd think something as straightforward as "start and stop services" would be standard across distributions. Gah.)
Ah sorry should have clarified! That's for CentOS / Redhat
This init script doesnt let the api clean up the lockfile properly, if you use sigterm instead of sigkill and then use signal to capture it, it should work between server reboots:
in the init script:
kill $(cat /var/run/nagios-api.pid)
in nagios-api:
atexit.register(_exitfunc)
# catch sigterm and exit cleanly
signal(SIGTERM, lambda signum, stack_frame: sys.exit(1))
Thanks for reviewing! @jonlives you willing to update the PR and I'll get it merged in?
@xb95 - PR updated :)
I updated the commit message and had to add a "from signal import signal, SIGTERM" line to get it to work. It works now, and has been committed.
https://github.com/xb95/nagios-api/commit/e56bd092d281238a803977a714dcf95deea778e9
Thank you for the submission!
remember that this script will not work under debian: http://wiki.debian.org/LSBInitScripts This should eventually be noted somewhere... :-)
Adding a basic init.d compatible startup / shutdown script