[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: init/rc scripts
- From: Vidiot <brown mrvideo vidiot com>
- To: redhat-list redhat com
- Subject: Re: init/rc scripts
- Date: Tue Apr 30 23:59:01 2002
>> If you do "/etc/init.d/fapsrv start" and then follow it with
>> "/etc/init.d/fapsrv stop", does the server actually start and then stop?
>
>Sorry, did miss saying that but yes I did test and, except for not
>having RUNLEVEL defined, it does execute correctly to start and
>stop the database servers as it should.
Crap, now you got me going as to what is happening. The script is too damn
simple not to work.
>> Correct me if I am wrong, but /tmp might not be the right place to put it.
>> I believe that /tmp gets cleaned out at boot time, which means only the
>> script start will show up.
>>
>> Place the output into /var/log, or drop it as /fapsrv.log.out
>
>I am new to Linux and had not been aware of that. It would also
>mean some redesign of otherthings as well. Retried with both
>/var/log/fapsrv.log and /fapsrv.log and only the start execution
>shows.
Doesn't make any sense. As a refresher, here is the script:
:
STATE=$1
RUNLEVEL=${RUNLEVEL:-`who -r | awk '{print $3}'`}
case ${STATE} in
'start')
/usr/bin/fapdbstart
;;
'stop')
/usr/bin/fapdbstop -q
;;
esac
Here is a new version of the script:
#!/bin/bash
RUNLEVEL=${RUNLEVEL:-`runlevel | cut -d " " -f 2`}
case "$1" in
start)
echo /usr/bin/fapdbstart
;;
stop)
echo /usr/bin/fapdbstop -q
;;
*)
echo "Usage: fapsrv {start|stop}"
;;
esac
First off, it fixes the RUNLEVEL problem. Secondly it catches a missing
command line option.
Did it make a difference in the operation? Nope. Manually running your
script resulted in:
mrvideo.ZROOT <154> ./doit start ; ./doit stop ; doit
who: invalid option -- r
Try `who --help' for more information.
./doit: /usr/bin/fapdbstart: No such file or directory
who: invalid option -- r
Try `who --help' for more information.
./doit: /usr/bin/fapdbstop: No such file or directory
who: invalid option -- r
Try `who --help' for more information.
Does exactly as expected.
I run my version and get:
mrvideo.ZROOT <152> ./doit start ; ./doit stop ; doit
/usr/bin/fapdbstart
/usr/bin/fapdbstop -q
Usage: fapsrv {start|stop}
Of course, if you use what I have, remove the echo from the start and stop
lines :-)
You don't need the ' characters around the case words.
I see no reason why this shouldn't work.
Before the case statement, add the following lines:
date >> /fapsrv.log.out
echo "RUNLEVEL = $RUNLEVEL" >> /fapsrv.log.out
echo "Command option = $1" >> /fapsrv.log.out
echo "" >> /fapsrv.log.out
Change the case line to:
case "$1" in
and remove the SATE line. It isn't necessary.
I don't know where you were placing some test lines, but add these and
report back. I can't create a dummy init.d script and test it, since my
Linux box is my very popular web/ftp server. Bouncing it up and down
will cause all kinds of grief with users.
Report back what the new log has to say.
Oh, if you want to do some higher level debugging, copy your current fapsrv
script to fapsrv.debug. Create a new fapsrv script that contains the following:
#!/bin/bash
echo >> /fapsrv.log.out
echo "##########
echo "# Start of $1 run..." >> /fapsrv.log.out
echo "##########
bash -x /etc/init.d/fapsrv.debug $1 >> /fapsrv.log.out
echo >> /fapsrv.log.out
echo "##########
echo "# End of $1 run" >> /fapsrv.log.out
echo "##########
echo >> /fapsrv.log.out
echo >> /fapsrv.log.out
echo >> /fapsrv.log.out
That will give you a line-by-line capture of what the script is doing.
>Thanks muchly for your input it is appreciated.
We'll get it yet.
MB
--
e-mail: vidiot vidiot com It is God's job to forgive bin Laden.
It is our job to set up the meeting.
U.S. Marine Corp.
Visit - URL: http://www.vidiot.com/ (Your link to Star Trek and UPN)
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]