I wanted to have a general RHEL/CentOS init script that I could drop onto servers to start node processes. The features I wanted were:
- Ability to reuse it for multiple node processes on the same server.
- Ability to run as non-root user.
- The classic service start/stop/restart/status functionality.
I had previously written a node init script using forever, but I ended up not liking it. This script still isn’t perfect, but it seems more generally useful to me.
Drop the script in
/etc/init.d/[name] and make it executable, the custom configuration in
/etc/sysconfig/[name], and use
service [name] start to fire it up.