servers often store their (main) process id in a "pid" file, and create a
(empty) lock file (by just touching it). if the startup script is called
twice, the lock file prevents the server to be lauched twice. when the
shutdown script is called, it removes the lock file, and usually gets the
server's pid from the pid file, then sends that process a kill signal.

in your case i'm not sure this is necessary at all : just do a "killall
-YOURSIGNAL userprocessname" in the shutdown script, and it should be enough.

hth,




A 12:57 19/02/2001 -0600, vous avez écrit :
>I have a user process that needs to be shutdown cleanly on a reboot or a
>halt.  I tried simply placing a symlink to my script that will shut it
>down named /etc/rc.d/rc6.d/K06killscript but did not work.  It appears
>rc will only call the script if this script exists (it does), or if it
>can find a file in /var/lock/subsys see below from /etc/rc.d/rc:
>
>               # Check if the subsystem is already up.
>                subsys=${i#/etc/rc.d/rc$runlevel.d/K??}
>                [ ! -f /var/lock/subsys/$subsys ] && \
>                    [ ! -f /var/lock/subsys/${subsys}.init ] && continue
>
>                # Bring the subsystem down.
>                if egrep -q "(killproc |action )" $i ; then
>                        $i stop
>                else
>                        action "Stopping $subsys" $i stop
>                fi
>
>
>The user the process runs under does not have access to write to
>/var/lock/subsys for obvious reasons and does not need to run as root.  
>
>Is there a mechanism similar to rc.local to run scripts before shutdown
>or do I have to make the thing smart enough to trap the kill signal and
>kill itself?  The problem with that is that it is an X program and xfs
>has long since been killed by the time killall5 is called.
>
>I hate to modify the basic rc script but will do so if that is the only
>way.  
>
>btw what does this do (from the rc script also)
>
>subsys=${i#/etc/rc.d/rc$runlevel.d/S??}
>
>I am assuming that i is the i in the for loop this statement is in but
>the combination of ${i# etc has me stumped
>
>TIA 
>Bret
>
>
>
>_______________________________________________
>Redhat-list mailing list
>[EMAIL PROTECTED]
>https://listman.redhat.com/mailman/listinfo/redhat-list
>
>
                        - * - * - * - * - * - * -
Mes idees n'engagent que moi (vieux proverbe du Net)

Thierry ITTY
eMail: [EMAIL PROTECTED]                FRANCE



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to