Re: (AIX 5L) (NOT A) MYTH: Shutdown scripts can be placed in /etc/rc.d/rcX.d
- From: na <google@xxxxxxxxxxx>
- Date: Fri, 25 Jul 2008 09:40:30 -0700 (PDT)
Thanks to Casey and J.J. for their excellent replies. I had a
feeling I was going to get educated, and I was right! Here is a bit
more for anyone following along, some additional information that they
might find useful.
Of course, casey was right about shutdown being a shell script, and
calling only the kill scripts. Duh!!! -- just goes to show what being
a newb is all about!
In looking at the shutdown script, it appears as I read it that the
KillScripts in every rc.d/rcX.d will get run, since they all get
collated together. Again, nothing to get to excited about, but not
very obvious or intuitive. I would have expected that it would have
checked the current run level and would have run only those K's. But
what the hey. (For entertainment, I've cut out the script segment
and again pasted at the bottom of this post.)
Re JJs post --- as he notes, he hasn't worked with AIX, and in fact
the run levels are in fact different. (In fact they are pretty much
undefined except that 0 and 1 are "reserved" and 2 is offically
defined as Multiuser mode with NFS resources shared. There's also a
special a,b and c "psuedo" level.) I can see where his suggestion on
utililing "K" scripts would be useful if AIX used them in a more
standard method. (Although I'd still posit that it would just be
cleaner/ more intuitive if at startup only the S scipts were run. If
a run level change was made, firstrun the kill kill scripts in your
current runlevel, then the startup in the level you are moving to.
But since that is a wish and not how AIX behaves, his point is well
taken.)
Again, thanks to both gents, and hope posterity finds this post useful
somehow! ;-0
============ SHUTDOWN scrpt excerpt =============
# Let system know that we are starting our shutdown sequence.
reboot -p
if [ $nohalt = off ]
then
# /etc/rc.shutdown is for adminstrators to create for
their
# own local needs. If it is not successful, shutdown
will
# abort.
if [ -x /etc/rc.shutdown ]
then
sh /etc/rc.shutdown
if [ $? -ne 0 ] ; then
dspmsg -s 1 shutdown.cat 60 \
"/etc/rc.shutdown failed. Shutdown aborting.
\n"
exit 1
fi
fi
# Added to run stop scripts for all runlevels
rcdirs=`ls /etc/rc.d | grep "rc[0-9].d"`
echo "${rcdirs}" | while read dir
do
#get a list of the "kill" scripts in this directory
k_list=$(ls /etc/rc.d/${dir} | grep "^K" | sort -)
#execute "kill" scripts
if [[ -n ${k_list} ]] then
echo "${k_list}" | while read item
do
/etc/rc.d/${dir}/${item} stop
done
fi
done
# End of stop scripts
============ SHUTDOWN scrpt excerpt end =========
.
- References:
- Prev by Date: AIX - LDAP
- Next by Date: Is there a way to mount a JFS with Direct I/O on system reboot?
- Previous by thread: Re: (AIX 5L) MYTH: Shutdown scripts can be placed in /etc/rc.d/rcX.d
- Next by thread: AIX - 452 Error - need help
- Index(es):
Relevant Pages
|