HylaFAX The world's most advanced open source fax server

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [hylafax-users] killall on Compaq tr



Hi,

Having looked into the start/stop script a bit further it would appear that this problem has been seen before, and there is code there that should work around it.

However, this code doesn't work in all cases. What it would appear to be doing is issuing a killall -l to work out whether or not the killall command works in the expected fashion. However killall -l on Tru64 returns the same as what it would on a "correct unix", and the script therefore assumes that it is safe to use killall $1 $2. This is a rather dangerous assumption to make.

To get things to work safely, I've done the following:

# killall -SIGNAL process-name
#
# Emulate the necessary functionality if the
# killall program doesn't do the expected...
#
# if ($KILLALL -l >/dev/null) 2>/dev/null; then
#    killall()
#    {
#       $KILLALL $1 $2
#    }
#else
    killall()
    {
        £ NB: ps ax should give an error on System V, so we try it first!
        pid="`ps ax 2>/dev/null | awk \"\
                /[\/ (]$2[ )]/  {print \\$1;}
                /[\/ ]$2\$/     {print \\$1;}\"`"
        test "$pid" ||
            pid="`ps -e 2>/dev/null | awk \"/ $2[ ]*\$/ {print \\$1;}\"`"
        test "$pid" && kill $1 $pid; return
    }
# fi

As well as commenting out the if else bit, I've also changed $AWK to awk, as the script doesn't appear to set up this variable. I've not had opportunity to test this in my live environment yet, as I don't want to inadvertently bounce the machine again, however it should work.


Regards,

Rob

 -----Original Message-----
From: tim@multitalents.net [SMTP:MIME :tim@multitalents.net]
Sent: Tuesday, April 24, 2001 5:00 PM
To: Rob Leadbeater
Cc: hylafax-users@hylafax.org
Subject: Re: [hylafax-users] killall on Compaq tru64 unix
On Tue, 24 Apr 2001 rob.leadbeater@lynx.co.uk wrote:

> Hi,
> > Just thought I'd warn everyone about a not so nice feature of Hylafax 

when running on Compaq Tru64 Unix (aka dec-osf)

Is killall in /sbin on Tru64 UNIX?
If not, it will use the shell function.

> > The init script for Hylafax uses the command killall, to shutdown all 

Hylafax processes.
> > As I just discovered to my horror, killall on Tru64 does something
rather different to what it does on other unixes...
> > Taken from the Tru64 man page:
> killall(8)
killall(8)
> > NAME
>   killall - Terminates all processes started by the user, except the
calling
>   process
> > Compare this with the Linux version, and you'll see why issuing a
init.d/hylafax stop when root tends to annoy a few hundred people !!
>

On Linux, killall is in /usr/bin so the shell function in the hylafax
start/stop script is used.

> KILLALL(1)                User Commands                KILLALL(1)
> > NAME
>        killall - kill processes by name
[snip]
>

 -- Tim Rice    Multitalents (707) 887-1469
tim@multitalents.net




This message is intended only for the use of the person(s) ("The intended
Recipient(s)") to whom it is addressed.  It may contain information which
is privileged and confidential within the meaning of applicable law.  If
you are not the intended recipient, please contact the sender as soon as
possible.  The views expressed in this communication are not necessarily
those held by LYNX Express Limited.


____________________ HylaFAX(tm) Users Mailing List _______________________
 To unsub: mail -s unsubscribe hylafax-users-request@hylafax.org < /dev/null




Project hosted by iFAX Solutions