Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

On RedHat EL 6, many services can be started and stopped on the command line:

service some_service start

and

service some_service stop

I have packaged a Node.JS server application in an RPM. How can I register my app to service, for easy start and stop?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

You will need to write an init script for your service and install it in the /etc/rc.d/init.d directory.

I found one example script on Github; it may be of use to you after some minor customization. And an Internet search will probably turn up other such scripts.

share|improve this answer

Look at the RPM guidelines for Fedora (Fedora is upstream for RHEL, so they should be applicable with some futz for newer versions). You will still have to write the init script, that is more of a black art. Filch the /etc/init.d file for something similar as a starting point, compare to others.

Be advised that Fedora switched to systemd, and it is a given that RHEL 7 will use that also. That means that startup is radically changed (and writing of startup files much simplified). Perhaps you should install latest Fedora and start experimenting.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.