LinuxQuestions.org
Visit Jeremy's Blog.
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, 11:53 PM   #1
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Rep: Reputation: 30
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, 01:16 AM   #2
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 75
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 01:17 AM.
 
Old 05-16-2008, 01:56 AM   #3
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,130

Original Poster
Rep: Reputation: 30
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, 08:08 AM   #4
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 75
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, 08:50 AM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,361
Blog Entries: 55

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


Reply


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

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

All times are GMT -5. The time now is 06:16 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration