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

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

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 how to change the old way of turning 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.

In the realm of system administration, optimizing startup processes is crucial for ensuring the seamless operation of servers. Among the various methods available, automating the startup of bash scripts after rebooting stands out as a practical solution. 

This article delves into the process of setting up auto-start bash scripts on CentOS 6, offering a streamlined alternative to manual service activation and simplifying system management tasks.

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 autostart

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.

Closing statement

In conclusion, this article has demonstrated a straightforward method for automating the startup of a bash script after rebooting on CentOS 6. By leveraging the rc.local file, we can effortlessly ensure that our desired services or commands are executed upon system boot. 

This approach simplifies the process of managing startup services, offering a practical solution for ensuring the seamless operation of essential scripts or services. 

Whether for system maintenance or custom application requirements, integrating auto-start functionality into bash scripts streamlines system administration tasks.

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"