There are many solutions to automatically execute shell commands during the start-up process. My favorite is using services.
So we are going to create a small script in /etc/init.d/ and use chkconfig to auto start it on boot. We call the service “starter”!
And add the following code to starter:
#!/bin/bash # chkconfig: 345 99 10 # description: starting some commands at boot # case "$1" in 'start') /usr/local/bin/searchd python /opt/deploy/main.py echo "started" >> /home/user/service.track ;; 'stop') killall searchd killall python ;; esac
And finally set permissions and configure the chkconfig:
chmod +x /etc/init.d/starter chkconfig starter on