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

Re: how to shut pppd in script



Vladimir Popov wrote:
  >Hi,
  >
  >The idea is to disconnect from ISP after all scripts in /etc/ppp/ip-up.d/ ar
      >e
  >executed. When I run script:
  >
  >=========
  >#!/bin/sh
  >if test -e shut.ppp
  >then
  >  echo "It exists"
  >else
  >  echo "It doesn't exists"
  >fi
  >=========
  >
  >everything is ok. But when I place script
  >
  >=========
  >#!/bin/sh
  >if test -e shut.ppp
  >then
  >  kill 'cat /var/run/ppp0.pid'
  >fi
  >=========
  >
  >in /etc/ppp/ip-up.d it isn't working. If I run in command line  
  >
  >kill 'cat /var/run/ppp0.pid'
  >
  >it works. Where I'm wrong?

[I assume those single quotes (') are actually backquotes (`)? Otherwise
it would never work.]

I suspect that the ppp0.pid file is not written until after the ip-up
script has run.  Try putting a line in ip-up to test this:

  ls -l /var/run/ppp0.pid >/tmp/ppp.test 2>&1

and see what you get in /tmp/ppp.test.

-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight                              http://www.lfix.co.uk/oliver
               PGP key from public servers; key ID 32B8FAA1
                 ========================================
     "Behold, happy is the man whom God correcteth.  
      Therefore despise thou not the chastening of the  
      Almighty."         Job 5:17 



Reply to: