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

Re: Script to check whether modem telephone line in use --- how?



On Thu, 1 Apr 1999, Mark Phillips wrote:
>This morning I typed "pon" to dial up a ppp connection, only to hear
>noise on my modem to idicate that the line was already in use.  I
>quickly typed "poff", but it was too late --- I had already killed my
>father's connection to the internet.  He was not pleased as I had
>killed his connection near the end of an 8M download.
>
>Anyway, I don't want this to happen again, so I would like, if
>possible, to write a script which does nothing except listen to the
>modem line for a few seconds so that I can hear whether someone else
>is using it.  I have some idea about how such a script would go, but
>would appreciate some input.  Here is what I propose:


Hi Mark,
	Put this is /usr/local/bin and call it ispon It isnt anything 
fancy but it should work for you until ppp's maintainer, Philip Hands, has
time to maybe add a check into ppp itself. when run it'll simply tell you
if pppd is or isn't running.

File: ispon

--begin--
#!/bin/sh
#Grep to see if pppd is running and as root and tell us yes/no.
#Simply change root to username of user running pppd or
#remove it completely if you wish. Hope this helps.
#chmod 700 /usr/local/bin/ispon

if (ps auxww |grep root |grep /usr/sbin/pppd |grep -v grep >/dev/null)
then
echo "Currently pppd IS running"
else
echo "Currently pppd is NOT running"
exit 0
fi
--end--



-Rob


Reply to: