Create custom service to auto start commands on boot

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”!

vi /etc/init.d/starter

And add the following code to starter:

# chkconfig: 345 99 10
# description: starting some commands at boot
case "$1" in
	python /opt/deploy/
	echo "started" >> /home/user/service.track
	killall searchd
	killall python

And finally set permissions and configure the chkconfig:

chmod +x /etc/init.d/starter
chkconfig starter on

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s