Discussion:
modem lock
(too old to reply)
noel david
2009-09-22 18:48:28 UTC
Permalink
Hi folks

I have a Centos 5.3 linux box. I have a modem attached to ttyS0 wich
is used for dialin conections. I decided to setup a cron triguered
dialout conection just for clamav actualization and other tasks in
night hours. Main question and maybe it's a dumb one, how can I know
if somebody is already conected to my server in order to know if moden
is free to dialout or if it's busy in some dialin ppp conection. If
the answer is the existence of a lock file, where can I found it.
Another question is what if it's an spurius lock file ... and how to
avoid this.

Cheers David
Moe Trin
2009-09-23 19:42:32 UTC
Permalink
On Tue, 22 Sep 2009, in the Usenet newsgroup comp.protocols.ppp, in article
<32e9676e-1cc6-4df9-9f77-***@m11g2000vbl.googlegroups.com>,
noel david wrote:

NOTE: Posting from groups.google.com (or some web-forums) dramatically
reduces the chance of your post being seen. Find a real news server.
Main question and maybe it's a dumb one, how can I know if somebody is
already conected to my server in order to know if moden is free to
dialout or if it's busy in some dialin ppp conection.
How about looking at the output of the command '/sbin/ifconfig' ? In
your cron script,

LINK=`/sbin/ifconfig | grep ppp`
if [ -n $LINK ] ; then
your.commands.to.dial.out
else
exit 1 #modem was in use
fi
If the answer is the existence of a lock file, where can I found it.
lock Specifies that pppd should create a UUCP-style lock file
for the serial device to ensure exclusive access to the
device. By default, pppd will not create a lock file.

Lock files should be in /var/lock named after the device, such as
/var/lock/LCK..modem or /var/lock/LCK..ttyS1 or similar.
Another question is what if it's an spurius lock file ... and how to
avoid this.
pppd is pretty good about cleaning up lock files - as long as you did
not 'kill -9' the daemon.

Old guy

Loading...