LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-15-2008, 10:53 PM   #1
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Rep: Reputation: 31
Run script after server re-start


I want the linux server will automatically run a script after server restart , I know add the script to /etc/rc.d/init.d will do for RH server ,how about Debian ? is all distro the same ?

thx
 
Old 05-16-2008, 12:16 AM   #2
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
You can add the script to /etc/init.d and then run
Code:
update-rc.d -f SOME_SERVICE start 99 2 3 4 5
Replace SOME_SERVICE with the name of the script you put in /etc/init.d.

Last edited by reddazz; 05-16-2008 at 12:17 AM.
 
Old 05-16-2008, 12:56 AM   #3
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by reddazz View Post
You can add the script to /etc/init.d and then run
Code:
update-rc.d -f SOME_SERVICE start 99 2 3 4 5
Replace SOME_SERVICE with the name of the script you put in /etc/init.d.

what is mean by 99 2 3 4 5 ? is it run at startup ?
 
Old 05-16-2008, 07:08 AM   #4
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
The 2 3 4 5 part represents the runlevels at which the script will be automatically run. 99 is the order in which the script is run.
 
Old 05-16-2008, 07:50 AM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Another trick (if you run cron) is to use @reboot, 'man 5 crontab' for details.
 
  


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
Trying to work out how to run a script with a start command or something similar helptonewbie Programming 6 05-31-2007 04:27 PM
Cannot run shell script on the remote server haresh_dba Linux - General 2 04-14-2007 09:26 AM
Using PHP to run a script on another server qscomputing Programming 4 04-12-2006 10:49 AM
How to start and run FTP server?? zaoka Linux - General 4 07-30-2005 05:01 PM
start up script run once ?? johnyy Linux - Software 1 12-28-2003 01:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

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