cancel
Showing results for 
Search instead for 
Did you mean: 

server startup script

snsd
Occasional Advisor

server startup script

I have newly installed Redhat v4 , it works fine , I want the server run some scripts after re-start , I tried to add the script to /etc/rc.local and also tried to add it to /etc/inittab , but it is not work , the script do not run after re-start the server , can advise what is wrong ? thx in advance.
3 REPLIES
Horia Chirculescu
Honored Contributor

Re: server startup script

Hello,

You should add you script in rc.local

Be sure that your script is working before adding it to rc.local (check chmod +x, check to specify in the first line the shell used in the script: #!/bin/sh or whatever shell you use there ...).

Horia.
Best regards from Romania,
Horia.
Hemmetter
Esteemed Contributor

Re: server startup script

Hi,

have a look at chkconfig(8) man page, and especially at "RUNLEVEL FILES" section.
Also have a look at service(8).

Then put your script into /etc/rc.d/init.d and create runlevel-links with

# chkconfig -a scriptname

Now your script is starting at boottime....

rgds
HGH

Wilfred Chau_1
Respected Contributor

Re: server startup script

Hi
you can try put the script in /etc/init.d.
then add the following 2 lines after the shell executable #! line.
# chkconfig: 345 90 10
# description:

** The chkconfig says the script will run in runlevel 3, 4 and 5 followed by the start and stop priority level no.

//next run
chkconfig --list |grep <script name>
to check the runlevels of the script.

//then run
chkconfig --level 345 <script name> on
so that the script will be ran at runlevel 3, 4 and 5