LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to run a script at system startup? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-run-a-script-at-system-startup-405619/)

correro 01-19-2006 10:03 PM

How to run a script at system startup?
 
I have a script file (for starting a service) that I would like the system to run when it boots. What should I do to achieve that?

My Linux box is Debian Sarge.

Thank you!

homey 01-19-2006 10:26 PM

Here's my notes on using my firewall script for Debian based systems like Knoppix or Feather:

Save the firewall script as /etc/init.d/firewall.

Important: Set the permissions for root to read, write and exec. Also, read and exec for group and others.

Something like chmod 755 /etc/init.d/firewall aught to do it.

Type: update-rc.d firewall defaults 99

correro 01-19-2006 10:34 PM

Thanks horney! It works!

homey 01-19-2006 11:38 PM

You're welcome! :)

haertig 01-20-2006 09:12 AM

If this is a service that you want to always be running, i.e., if it dies or you inadvertantly kill it, you want it automatically restarted, investigate starting it in /etc/inittab using "respawn". inittab is generally used to start system level things, but you can certainly use it for your own higher level stuff if it fits your needs.

Example: I run MythTV and I always want the backend to be running: So in my /etc/inittab:
Code:

# MythTV Backend
mt:2345:respawn:/bin/su - mythtv "/usr/local/bin/mythbackend -l /var/log/mythtv/mythbackend"



All times are GMT -5. The time now is 07:04 PM.