Hi,

I am trying to obtain the 'pid' of a script for when I do logging and
back tracking. The script is initiated from a shell command within the
ppp option files.  It happens like this:

A caller calls in and connects using ppp.  An ppp option file for that
serial port (ie options.ttyC6) includes the 'welcome' option.  The ppp
'welcome' option initiates a shell that takes a commandline for an
argument.  In this case the 'welcome /etc/sysconfig/network-scripts/isp
start ttyC6 &'.

The isp script checks for and monitors the main connection to the
internet,  and logs to the syslogd. When the dialin user hangs up, pppd
will also kill the script.  

For logging and accounting purposes I need to track the connection and
up time of the connection. I will have to do this through pids.  The
problem is I cannot seemed to collect the correct pid. Every dialin
connection has an instance of the script, so sometimes i have 6 to 10 of
them all monitoring it own dialin port and insuring it has Internet
continuity. The only difference between each instance is the ttyCx
commandline option. The 'pidof' function keeps returning the pidof the
first instance.  When I do ps faux I see the pid in the logfile is not
the correct pid. In the script I do the following:

#!/bin/sh
#
# isp          This shell script takes care of starting and stopping
#              Main Internet Connection
#

# Source function library.
. /etc/rc.d/init.d/functions
ISPSH="sh $0 $1 $2"
PID=`pidof -s $ISPSH`
    ^--(back tic)---------^ My email client changed this to '
INFOENTRY="-p local0.info -t isp.sh[$PID]"

--<snip>--

[ -f $SCRIPT_HOME/isp ] || exit 0
case "$1" in
  start)
    logger $INFOENTRY "Looking for ISP Connection for $2"

--<snip to EOF>--

What kind of input can you give me on this?  Hopfully a solution.

thanks in advance
--
robert


-- 
  PLEASE read the Red Hat FAQ, Tips, Errata and the MAILING LIST ARCHIVES!
http://www.redhat.com/RedHat-FAQ /RedHat-Errata /RedHat-Tips /mailing-lists
         To unsubscribe: mail [EMAIL PROTECTED] with 
                       "unsubscribe" as the Subject.

Reply via email to