This script is a starting point for those packages that don't come with initialization script that you want to run as a daemon.
- CentOS/RHEL <= 6.x
- Linux systems that use init.d and not systemd (CentOS/RHEL 7)
- Clone to system from Github.
git clone https://github.com/bonusbits/initd_script.git /path/to/clone/
- Copy script to init.d
sudo cp /path/to/clone/initd_script.sh /etc/init.d/myserviced
- Make script executable
sudo chmod +x /etc/init.d/myserviced
- Edit Custom Variables
sudo vim /etc/init.d/myserviced
# region Edit These Variables
servicename=myserviced
binary=/bin/bash
script=/opt/application/runscript.sh
logfile=/var/log/myserviced/myserviced.log
pidfile=/var/run/myserviced/myserviced.pid
user=myservice
# endregion Edit These Variables
- Add to Chkconfig
sudo chkconfig --add myserviced