LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 01-19-2006, 10:03 PM   #1
correro
Member
 
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, 10:26 PM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
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, 10:34 PM   #3
correro
Member
 
Registered: Oct 2002
Distribution: RedHat 8.0
Posts: 140

Original Poster
Rep: Reputation: 15
Thanks horney! It works!
 
Old 01-19-2006, 11:38 PM   #4
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

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

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
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"
 
  


Reply



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 02:53 AM
Run Script at Startup?? usaf_sp SUSE / openSUSE 5 11-11-2005 01:43 PM
get a script to run on startup kram Debian 3 04-23-2005 02:23 PM
Run a script at startup iain.ross Linux - Newbie 8 08-27-2004 04:03 PM
How to run script on startup Angelis Linux - General 1 11-16-2003 05:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:22 AM.

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