LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   automate running scripts (https://www.linuxquestions.org/questions/linux-software-2/automate-running-scripts-105147/)

windyang12 10-17-2003 10:18 AM

automate running scripts
 
I have some shell scripts, and I want to run these scripts when I boot my machine. How to make this work automatically as root?

Thanks in advance!

mcleodnine 10-17-2003 10:33 AM

to have them run at boot you could ass them to your /etc/rc.d/rc.local. Note that the file can be in different locations for different ditributions. If you can't find it try 'find /etc -name rc.local'

coolamit78 10-17-2003 10:41 AM

Ok....you can do this using any of the following ways:

1. You can place your executable shell scripts under /etc/rc.d/init.d. All the scripts in this directory are run when the system starts up.

OR

2. ( The Better option)

Make your scripts executable and put them under the directory /usr/local/bin

Now in the /etc/rc.local script, call your scripts one by one. For your reference, I am posting my own rc.local script which calls another script (load_sound_tv_radio.sh) that loads the modules for sound and tv.

#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local

/usr/local/bin/load_sound_tv_radio.sh
[You can call your custom made scripts here]

Hope that helps

Regards,

amit

windyang12 10-17-2003 11:29 AM

Thanks so much for your replies! I'll try ...


All times are GMT -5. The time now is 05:17 AM.