[ale] RedHat chkconfig & init scripts

Jeff Lightner jlightner at water.com
Mon Apr 2 13:56:15 EDT 2007


FYI:  Adding the syntax for the lock file resolved the issue.

Thanks to those who replied.

-----Original Message-----
From: ale-bounces at ale.org [mailto:ale-bounces at ale.org] On Behalf Of Jeff
To: ale at ale.org
Lightner
Sent: Friday, March 30, 2007 11:45 AM
To: Atlanta Linux Enthusiasts
Subject: Re: [ale] RedHat chkconfig & init scripts

Right.  As I said it wasn't a big deal since the start was working and
as you say the final kill of processes shuts it down.   Just like to
solve little mysteries like this when I can.   Had this been a DB
start/stop then the stop would have been more important to prevent
possible corruption of the DB.

It will be next week before I can test the lock file and I'll post the
results her.

-----Original Message-----
From: ale-bounces at ale.org [mailto:ale-bounces at ale.org] On Behalf Of
To: ale at ale.org
James P. Kinney III
Sent: Friday, March 30, 2007 11:22 AM
To: Atlanta Linux Enthusiasts
Subject: Re: [ale] RedHat chkconfig & init scripts

Ah Ha! That looks like the place to dig. I don't use the lock files for
my custom stuff as a blunt SIGKILL will not cause problems.

On Fri, 2007-03-30 at 10:43 -0400, Jeff Lightner wrote:
> Apparently I am not explaining it well or you're not getting it.  It
> does NOT call the script at all during the shutdown so nothing in the
> script will be executed on the stop.
> 
> Anyway I think I've found the answer though I need to test it:
> In /etc/rc script it has:
> # Check if the subsystem is already up.
>      subsys=${i#/etc/rc$runlevel.d/K??}
>      [ -f /var/lock/subsys/$subsys -o -f /var/lock/subsys/$subsys.init
]
> \ 
>           || continue
> 
> I had seen detail about creating and removing a lock file in the
script
> I modeled from but didn't use that as I though the lock was specific
to
> the daemon that was being started for that process.   From a Google
> search it appears /etc/rc itself is using the lock to determine
whether
> or not it needs to stop.  If there is no lock file it doesn't stop
> because it assumes it never started.
> 
> One has to add syntax in the start routine to create the lock file
> (touch to create an empty file) then syntax in the stop to remove the
> lock file.   It appears the lock file's main purpose is to prevent
> restarting items that were started in other run levels if you switch
to
> another run level that has the S##name script for starting.
> 
> 
> -----Original Message-----
> From: ale-bounces at ale.org [mailto:ale-bounces at ale.org] On Behalf Of
> James P. Kinney III
> Sent: Friday, March 30, 2007 10:34 AM
> To: Atlanta Linux Enthusiasts
> Subject: Re: [ale] RedHat chkconfig & init scripts
> 
> OK. So do the manual process below:
> 
> cd /etc/rc6.d
> ln -s ../init.d/pc1_mid_tier K01pc1_mid_tier
> 
> now, edit the pc1_mid_tier script. Add a pair of lines
> echo "STOPPING pc1_mid_tier NOW" 
> sleep 5s
> to the stop case block. Verify that the line
> . /etc/rc.d/init.d/functions
> is at the top of the script after the comments and before anything
else.
> 
> Now try the reboot.
> 
> On Fri, 2007-03-30 at 09:27 -0400, Jeff Lightner wrote:
> > In my original description I noted that I manually ran it
successfully
> > for both start and stop from command line.
> > 
> > It succeeds on start after boot.
> > 
> > It does not even TRY to stop.   Again I don't believe the problem is
> > with the script - I believe the script is never even being attempted
> on
> > the stop during shutdown. 
> > 
> > -----Original Message-----
> > From: ale-bounces at ale.org [mailto:ale-bounces at ale.org] On Behalf Of
> > James P. Kinney III
> > Sent: Thursday, March 29, 2007 9:07 PM
> > To: Atlanta Linux Enthusiasts
> > Subject: Re: [ale] RedHat chkconfig & init scripts
> > 
> > On Thu, 2007-03-29 at 16:01 -0400, Jim Popovitch wrote:
> > > On Thu, 2007-03-29 at 15:55 -0400, Jeff Lightner wrote:
> > > > Yep.  I have it as K01pc1_mid_tier.   - the next thing to be
> stopped
> > is
> > > > K03dataeng and it runs fine.
> > > > 
> > > > On start it is the last thing started (S99pc1_mid_tier).
> > > 
> > > Couple of other things to check...
> > > 
> > > Is the execute bit set on /etc/init.d/pc1_mid_tier ?
> > 
> > What happens if you manually run /etc/init.d/pc1_mid_tier stop ?
> > If the app does not stop, the problem is on the init script stop
case
> > statement.
> > > 
> > > Can you execute /etc/rc3.d/S99pc1_mid_tier
> > > and /etc/rc3.d/K019pc1_mid_tier?  (to make sure the symlinks are
> > > correct)
> > > 
> > > Does /etc/init.d/pc1_mid_tier depend on any env variables that
might
> > not
> > > exist at shutdown?  Things like $PATH, $LANG, etc.
> > > 
> > > -Jim P.
> > > 
> > > _______________________________________________
> > > Ale mailing list
> > > Ale at ale.org
> > > http://www.ale.org/mailman/listinfo/ale
-- 
James P. Kinney III          
CEO & Director of Engineering 
Local Net Solutions,LLC        
770-493-8244                    
http://www.localnetsolutions.com

GPG ID: 829C6CA7 James P. Kinney III (M.S. Physics)
<jkinney at localnetsolutions.com>
Fingerprint = 3C9E 6366 54FC A3FE BA4D 0659 6190 ADC3 829C 6CA7
_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale



More information about the Ale mailing list