LinuxQuestions.org
Visit Jeremy's Blog.
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 08-29-2000, 10:08 PM   #1
tdavid6789
LQ Newbie
 
Registered: Aug 2000
Posts: 3

Rep: Reputation: 0
Angry


I'm familiar with making startup scripts in other unix platforms, but redhat 6.1 and 6.2 want to pass a start or stop command to the startup script. I have loaded a program that does not need the start and stop sent to it. The passing of the start kills the program. I just want to have a symbolic link to the programs executable run when the runlevel is reached. Any suggestions?
 
Old 08-30-2000, 07:46 AM   #2
jeremy
root
 
Registered: Jun 2000
Distribution: Debian, Red Hat, Slackware, Fedora, Ubuntu
Posts: 11,957

Rep: Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108
First put a file in /etc/rc.d/init.d that looks like the following:
Code:
#!/bin/sh
# Startup script for program

# Source function library.
. /etc/rc.d/init.d/functions

case "$1" in
  start)
                echo -n  "Starting program: " 
                daemon program
                echo
                ;;
        
  stop)
                echo -n "Shutting down program "
                killproc program 
                echo
                ;;

  *)            echo "Usage: program {start|stop}"
                exit 1

esac

exit 0
Then make soft links to the startup file in the appropriate rcN.d directories, where N is the runlevel. NOTE: If you do not want the program to run as a damon then take out the word daemon before the program name.

[Edited by jeremy on 08-30-2000 at 08:17 AM]
 
Old 09-01-2000, 08:16 PM   #3
tdavid6789
LQ Newbie
 
Registered: Aug 2000
Posts: 3

Original Poster
Rep: Reputation: 0
Thanks

Thanks I will try it soon!
 
Old 09-21-2000, 10:38 AM   #4
tdavid6789
LQ Newbie
 
Registered: Aug 2000
Posts: 3

Original Poster
Rep: Reputation: 0
Question startup works but kill doesn't seem to work..

Hello,

I used your script and it works on startup just fine. I now have a problem with the kill scripts. I made a ln -s to rc3.d, rc0.d, and rc6.d and the target was K??programname. ?? being like 01. I want to kill my application before the machine kills the rest of the scripts.Nothing depends on them. I want the script to kill the program on halt, reboot. The startup is obviously only in rc3.d because runlevel 3 is my default. I don't see any thing on the screen saying it killed my program when I halt or reboot. I do see messages on startup. Do you have any ideas? Is linux wierd about using particular numbers in startup and kill scripts in the rc directories?

I appreciate your help.
Thank You Tom
 
Old 09-21-2000, 10:53 AM   #5
jeremy
root
 
Registered: Jun 2000
Distribution: Debian, Red Hat, Slackware, Fedora, Ubuntu
Posts: 11,957

Rep: Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108Reputation: 3108
When the system changes runlevels it goes into the appropriate dir (we'll say /etc/rc.d/rc0.d for shutdown) and calls each script. If the filename is K99program it will call it with stop (./K99program stop). If the filename is S99program it will call it with start. The files are called in ascending order (starting with x00, ending with x99). You may want to change the echo in the stop case to "Shutting down programname" to make it more noticable.
 
Old 09-25-2000, 10:09 PM   #6
ctdp
Member
 
Registered: Sep 2000
Location: Michigan
Distribution: Redhat
Posts: 30

Rep: Reputation: 15
Run level 0 is halt and runlevel 6 is reboot. You will need to put your link to kill your program in the appropriate directory for these two runlevels to get it to work for both halt and reboot. Putting the kill link in runlevel 3 will not do anything for you. Also if you want the program to run while in X, you will need to put the start link in runlevel 5 also.
 
  


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
Red Hat Advance Server 2.1 startup problem imsajjadali Red Hat 2 07-02-2004 02:47 AM
Red Hat 9.0 hangs on startup Covel Linux - General 2 12-05-2003 06:46 PM
afs on red hat 9 wont startup markhod Linux - Software 0 10-21-2003 05:06 PM
blank screen on red hat 9 startup snoop24 Linux - Software 1 09-15-2003 11:56 AM
red hat 8 loopback fails on startup SoundMan125 Linux - Networking 3 05-24-2003 01:59 PM


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