Skip to content Skip to sidebar Skip to footer

How to Make Auto Start Bash Script After Reboot on CentOS 6

Several ways to make a change are necessary, now in my article this time I will share about how to change the old way to turn on a service manually and replace it with a simpler way after the system turns off, namely Auto start service which is created using a bash script.

How to Make Auto Start Bash Script After Reboot on CentOS 6
How to Make Auto Start Bash Script After Reboot on CentOS 6

Preparation

What you need to prepare is a bash script that will be auto-started after rebooting. You can also make even simple or complicated commands that you want to run.

Configure 

just go ahead because I already have a bash script and put it in "/home/kitsake/bin/startAll". we can directly call it in rc.local.

# vi /etc/rc.d/rc.local
....
echo "The computer booted up at" `date` >> /home/kitsake/log_rc.out
su - kitsake -c /home/kitsake/bin/startAll >> /home/kitsake/log_rc.out

Don't forget to save and close

Trying

To do the testing, you only need to reboot the system and see that the service you ordered in the bash script is running perfectly or you can also look at the log output that was created earlier.

# reboot
# ps -eaf|grep hdlxim

See the service that is made auto start
See the service that is made auto start

Yes, that's the way how the bash script can auto start after rebooting, maybe it can be a solution that can be applied to the system you have and be a small change.

Hope it is useful & Thank You.

Bangkit Ade Saputra
Bangkit Ade Saputra At the end of the day, my job involves people. we're complicated, we're always changing, we have millions of things going on in our lives, and changing jobs is always a big decision.

Post a Comment for "How to Make Auto Start Bash Script After Reboot on CentOS 6"