I've got a 3-rd party proprietary application server daemon which can be started and stopped by couple of command lines. I need this daemon to start when the system starts up and correctly stopped on system shutting down. How do I correctly implement this? Is it enough to copy some script inside /etc/init.d and modify it accordingly?
|
if you do not want to migrate to UPSTART, but want the classic approach, you must: NOTE: i am saving the service and the program with the same name in different directories (but you can change this, as long as it is reflected in your service file). change "myscriptname" and "myprogramname" to real names!
reboot your machine and check if the service has started properly
if your service is not starting properly, you should first check if it runs when called by hand:
below i include a sample service file that actually works. compare it to skeleton service so as to understand what you need to configure. NOTE: this works on Ubuntu 12.04 amazon cloud AWS EC2 classic LAMP implementation (also on Kubuntu 15.10).
|
|||||||||
|
|
"With pleaserun, you can generate the following launchers/scripts/whatever: launchd It also detects which init system is in use so it generates the script accordingly. |
|||||
|
|
Make a copy of /etc/init.d/skeleton and edit it at appropriate places to start/stop/restart your service. It is very well commented so you should be able to create a working init.d script in no time. |
|||||
|
|
init.d is the old, deprecated system for starting daemons; is has been supplanted by upstart. Upstart has the advantage of being far easier to configure and allows proper sequencing of task initialization. The configuration files for upstart live in /etc/init and if your daemon has no pre-requisites it can be as simple as tty1.conf:
in which case you can copy that file and modify to taste. More complex configurations are best documented at the upstart site and in other entries in /etc/init. added in response to commentWhether you use upstart or init.d, you'll still need some way of determining when Firebird is properly initialized. Unfortunately, Firebird itself doesn't seem to have a good way of verifying that it is installed and running. Therefore, the recommendation to stick your program start into /etc/rc.local is certainly the easiest, and on Ubuntu - at least - is guaranteed to run about as late as possible in the boot process. |
|||||
|
|
|||
|
|