I'd like to create my own init script to make my program start at boot and be controlled via "service" utility in most popular Linux distributions.
Requirements:
- it should be portable across different distros(it should support at least Debian/Ubuntu and RedHat/Centos)
- it shouldn't depend on any additionally installed packages
- it should control if my program started succesfully or encountered some kind of errors
- it should reliably stop my program when requested (sometimes init script say "stopping... OK" but it's still running)
For example, I can do it this way:
case "$1" in
start)
./start-jira.sh
;;
stop)
./stop-jira.sh
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac
But in this case it's required to check if program has been properly started with 'ps' and properly killed on shutdown.
Looking for the right way to do it. Is there any standard to satisfy all those systemd, upstart,etc. ?
Thanks