FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > CentOS > CentOS

 
 
LinkBack Thread Tools
 
Old 11-10-2010, 12:03 AM
Don Krause
 
Default Init.d script troubleshooting.

I got a strange problem with init.d scripts on a fully updated (as of today) fresh install of 5.5 x64.

I've written a script, /etc/init.d/Fast that starts a fairly large and slow commercial application, by calling that applications control binary to do the actual work.

I "registered" the script, via chkconfig --add Fast, and the symlinks are in the expected places.

[root@rpmbuilder etc]# ls /etc/rc*/*Fast
/etc/rc0.d/K10Fast /etc/rc4.d/S90Fast
/etc/rc1.d/K10Fast /etc/rc5.d/S90Fast
/etc/rc2.d/K10Fast /etc/rc6.d/K10Fast
/etc/rc3.d/S90Fast

[root@rpmbuilder etc]# ls -la init.d/Fast
-rwxr-xr-x 1 root root 2691 Nov 9 16:49 init.d/Fast
[root@rpmbuilder etc]#

Testing the script, both via "/etc/init.d/Fast start" and "service Fast start" works, and it fully works for the implemented "start","stop","status" commands.

"/etc/rc0.d/K10Fast stop" works as expected. (as does /etc/rc1,2,6 etc..)

The script contains full paths to everything.

At boot, the script functions as expected.

My problem is that at reboot, via shutdown -r or shutdown -h the script does NOT get called, so naturally the system doesn't get to clean up after itself, then it fails to startup correctly next boot.

The startup and shutdown of this application is slow, 2+ minutes. I know it doesn't work at reboot or halt because the host goes down fast, and the system is littered with left over pid files and such that prevents a clear restart of the Fast process.

I've placed echo commands in the script, both in the stop() function to log the date/time to a file when it's called, and in the head of the script itself, just to see if it gets called at all during shutdown.

As far as I can tell, the script does NOT get called at shutdown/reboot time. At all.

I'm just confused, this ain't supposed to be this hard... Is there some way to debug init?

Suggestions?

Thanks

<-- /etc/init.f/Fast -->
#!/bin/bash
#
# Startup script for Fast
#
# chkconfig: 345 90 10
# description: Fast Search Engine
# processname: nctrl
echo "************************* In Fast ****************************"
# Source function library
. /etc/init.d/functions

RETVAL=0

FASTSEARCH=/opt/Opti/9.1/Fast/fast
BIN=${FASTSEARCH}/bin
LIBPATH=${FASTSEARCH}/lib
SHLIB=${FASTSEARCH}/lib
LD_LIBRARY_PATH=${FASTSEARCH}/lib
PYTHONPATH=${FASTSEARCH}/lib/python2.3/lib-dynload

export FASTSEARCH LIBPATH SHLIB LD_LIBRARY_PATH PYTHONPATH

start() {
if [ -f ${BIN}/nctrl ]; then
cd ${BIN}
echo -n $"Starting Fast "
su fastadmin -c "./nctrl start"
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/fast
echo
fi
return $RETVAL
}

stop() {
echo -n $"Stopping Fast "
cd ${BIN}
su fastadmin -c "./nctrl stop"
RETVAL=$?
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/fast
echo
return $RETVAL
}

status() {
cd ${BIN}
su fastadmin -c "./nctrl status"
}

restart() {
stop
start
}

case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
killlock)
if [ -f /var/lock/subsys/fast ]; then
rm -f /var/lock/subsys/fast
fi
;;
status)
status
;;
*)
echo $"Usage: $0 {start|stop|restart|killlock|status}"
exit 1
esac

exit $RETVAL


--
Don Krause






_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 11-10-2010, 12:15 AM
Barry Brimer
 
Default Init.d script troubleshooting.

<snip>
> Testing the script, both via "/etc/init.d/Fast start" and "service Fast start" works, and it fully works for the implemented "start","stop","status" commands.
>
> "/etc/rc0.d/K10Fast stop" works as expected. (as does /etc/rc1,2,6 etc..)
>
> The script contains full paths to everything.
>
> At boot, the script functions as expected.
>
> My problem is that at reboot, via shutdown -r or shutdown -h the script does NOT get called, so naturally the system doesn't get to clean up after itself, then it fails to startup correctly next boot.
<snip>

I believe the name of the script in /etc/init.d needs to match the name of
the lock file dropped in /var/lock/subsys .. so either change the case of
your lockfile so it is called "Fast" and not "fast" to match the script or
change the name of script to "fast" the match the lockfile. For further
reference, please examine /etc/init.d/killall. This is the script that
stops things that have placed files in /var/lock/subsys.

Hope this helps.
Barry
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 11-10-2010, 12:33 AM
Don Krause
 
Default Init.d script troubleshooting.

On Nov 9, 2010, at 5:15 PM, Barry Brimer wrote:

> <snip>
>> Testing the script, both via "/etc/init.d/Fast start" and "service Fast start" works, and it fully works for the implemented "start","stop","status" commands.
>>
>> "/etc/rc0.d/K10Fast stop" works as expected. (as does /etc/rc1,2,6 etc..)
>>
>> The script contains full paths to everything.
>>
>> At boot, the script functions as expected.
>>
>> My problem is that at reboot, via shutdown -r or shutdown -h the script does NOT get called, so naturally the system doesn't get to clean up after itself, then it fails to startup correctly next boot.
> <snip>
>
> I believe the name of the script in /etc/init.d needs to match the name of
> the lock file dropped in /var/lock/subsys .. so either change the case of
> your lockfile so it is called "Fast" and not "fast" to match the script or
> change the name of script to "fast" the match the lockfile. For further
> reference, please examine /etc/init.d/killall. This is the script that
> stops things that have placed files in /var/lock/subsys.
>
> Hope this helps.
> Barry


Wow... It works now...

Thanks much. I didn't see that in the documentation, interesting info.
--
Don Krause






_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 
Old 11-10-2010, 01:07 AM
Barry Brimer
 
Default Init.d script troubleshooting.

> On Nov 9, 2010, at 5:15 PM, Barry Brimer wrote:
>
>> <snip>
>>> Testing the script, both via "/etc/init.d/Fast start" and "service Fast start" works, and it fully works for the implemented "start","stop","status" commands.
>>>
>>> "/etc/rc0.d/K10Fast stop" works as expected. (as does /etc/rc1,2,6 etc..)
>>>
>>> The script contains full paths to everything.
>>>
>>> At boot, the script functions as expected.
>>>
>>> My problem is that at reboot, via shutdown -r or shutdown -h the script does NOT get called, so naturally the system doesn't get to clean up after itself, then it fails to startup correctly next boot.
>> <snip>
>>
>> I believe the name of the script in /etc/init.d needs to match the name of
>> the lock file dropped in /var/lock/subsys .. so either change the case of
>> your lockfile so it is called "Fast" and not "fast" to match the script or
>> change the name of script to "fast" the match the lockfile. For further
>> reference, please examine /etc/init.d/killall. This is the script that
>> stops things that have placed files in /var/lock/subsys.
>>
>> Hope this helps.
>> Barry
>
>
> Wow... It works now...
>
> Thanks much. I didn't see that in the documentation, interesting info.

Glad it works!

Barry
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos
 

Thread Tools




All times are GMT. The time now is 06:26 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org