Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-19-2006, 11:03 PM   #1
Registered: Oct 2002
Distribution: RedHat 8.0
Posts: 140

Rep: Reputation: 15
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!
Old 01-19-2006, 11:26 PM   #2
Senior Member
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 59
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
Old 01-19-2006, 11:34 PM   #3
Registered: Oct 2002
Distribution: RedHat 8.0
Posts: 140

Original Poster
Rep: Reputation: 15
Thanks horney! It works!
Old 01-20-2006, 12:38 AM   #4
Senior Member
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 59
You're welcome!
Old 01-20-2006, 10:12 AM   #5
Senior Member
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,236

Rep: Reputation: 348Reputation: 348Reputation: 348Reputation: 348
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:
# MythTV Backend
mt:2345:respawn:/bin/su - mythtv "/usr/local/bin/mythbackend -l /var/log/mythtv/mythbackend"


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
'cannot stat' script in /etc/rc.d/, try to run script at startup quintan Linux - Software 1 11-21-2005 03:53 AM
Run Script at Startup?? usaf_sp SUSE / openSUSE 5 11-11-2005 02:43 PM
get a script to run on startup kram Debian 3 04-23-2005 03:23 PM
Run a script at startup iain.ross Linux - Newbie 8 08-27-2004 05:03 PM
How to run script on startup Angelis Linux - General 1 11-16-2003 06:45 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:19 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration