|
From: Leif M. <le...@ta...> - 2005-12-12 12:07:00
|
Donatas,
Good work tracking that down. Looking at Debian at least. the
/var/lock/ directory
exists, but not the /var/lock/subsys/ directory. One thing that I
could do is to look for
the /var/lock/subsys/ directory and create that lock file if it
exists. It might make more
sense to do it within the wrapper process however, that way if the
wrapper process
dies, the lock file will get deleted like the pid file does.
Opinions on this from anyone else welcome as well. Not really sure
what is best
here. Though I would like the scripts to work out of the box as much as
possible.
How do other application scripts function on Fedora? If they are
designed to be
run on linux systems as well, I could take a look at them for clues.
Cheers,
Leif
Donatas Ciuksys wrote:
> Hi again,
>
> Well I got it running (I meen stopping :) ). It seems it is Fedora specific
> (or might be not only Fedora) - I had to modify little bit your start-up
> script. As I figured out, Fedora does not run shutdown script with stop
> argument until you have lock file in directory /var/lock/subsys/. So I
> modified script as follows (the name of my script is
> /etc/init.d/frtdcypher):
>
> ---------------------------------
> start() {
> echo "Starting $APP_LONG_NAME..."
> getpid
> if [ "X$pid" = "X" ]
> then
> touch /var/lock/subsys/frtdcypher <------- create
> lock file
> if [ "X$IGNORE_SIGNALS" = "X" ]
> ...
>
> stopit() {
> echo "Stopping $APP_LONG_NAME..."
> getpid
> if [ "X$pid" = "X" ]
> then
> echo "$APP_LONG_NAME was not running."
> else
> rm -f /var/lock/subsys/frtdcypher <-------- remove
> lock file
> if [ "X$IGNORE_SIGNALS" = "X" ]
> ...
> ----------------------------------
>
> This is excerpt from /etc/rc.d/rc (this script executes all the shutdown
> scripts):
>
> # First, run the KILL scripts.
> for i in /etc/rc$runlevel.d/K* ; do
> check_runlevel "$i" || continue
>
> # 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
>
> # Bring the subsystem down.
> if LC_ALL=C egrep -q "(killproc |action )" $i ; then
> $i stop
> else
> action $"Stopping $subsys: " $i stop
> fi
> done
> ----------------------------------
>
> Well, seems each different linux distribution has its own rules.
>
> Thank you for hint to check whether shutdown script is being called on
> system exit.
>
> Cheers,
> Donatas
>
|