Re: Reducing log file noise

2010-03-28 Thread Tom Munro Glass
> You need the device ID - lsusb to list.
> 
> http://www.reactivated.net/writing_udev_rules.html
> 
> > Will this run as root, because the script would need to patch
> > /etc/inittab and then call 'telinit q'?
> 
> No... the udev rule is instead of, not to enable inittab. If you really
> need the always up testing functionality, then maybe look at DJB's
> daemon tools.
> 
> > Tom
> 
> I can't believe I've just recommended some of Dan's software. Off for a
> lie down!
> 
> Cheers,
> 
> Steve

Thanks for the link Steve, and I think I now understand how to write the udev 
rule with the RUN+= assignment. What I don't understand is what to put in the 
script that I call since it has to return very quickly or detach itself. 

Do I just need to launch mgetty if the udev ACTION=add or kill mgetty if 
ACTION=remove? Presumably mgetty will still call ppp once a call comes in, and 
the rest of the dial-up settings remain the same.

Tom


Re: Reducing log file noise

2010-03-28 Thread Steve Holdoway
On Mon, 2010-03-29 at 11:39 +1300, Tom Munro Glass wrote:
> On Mon, 29 Mar 2010 11:25:12 Solor Vox wrote:
> > I'd suggest using a udev rule that runs simple script to enable/disable
> > your tty.  All you'd need to do is match your modem in a udev rule and
> > call a script to change your inittab.
> > 
> > That way it only runs if/when the modem is plugged-in.
> > 
> > Cheers,
> > sV
> > 
> This sounds like a good solution - could you possibly give me a pointer on 
> how 
> to write the udev rule, because I haven't done this before? When the modem is 
> plugged in the device is /dev/ttyACM0, and the driver module is cdc_acm. 
You need the device ID - lsusb to list.

http://www.reactivated.net/writing_udev_rules.html


> 
> Will this run as root, because the script would need to patch /etc/inittab 
> and 
> then call 'telinit q'?
No... the udev rule is instead of, not to enable inittab. If you really
need the always up testing functionality, then maybe look at DJB's
daemon tools. 
> 
> Tom

I can't believe I've just recommended some of Dan's software. Off for a
lie down!

Cheers,

Steve


-- 
Steve Holdoway 
http://www.greengecko.co.nz
MSN: st...@greengecko.co.nz
GPG Fingerprint = B337 828D 03E1 4F11 CB90  853C C8AB AF04 EF68 52E0


signature.asc
Description: This is a digitally signed message part


Re: Reducing log file noise

2010-03-28 Thread Tom Munro Glass
On Mon, 29 Mar 2010 11:25:12 Solor Vox wrote:
> I'd suggest using a udev rule that runs simple script to enable/disable
> your tty.  All you'd need to do is match your modem in a udev rule and
> call a script to change your inittab.
> 
> That way it only runs if/when the modem is plugged-in.
> 
> Cheers,
> sV
> 
This sounds like a good solution - could you possibly give me a pointer on how 
to write the udev rule, because I haven't done this before? When the modem is 
plugged in the device is /dev/ttyACM0, and the driver module is cdc_acm. 

Will this run as root, because the script would need to patch /etc/inittab and 
then call 'telinit q'?

Tom


Re: Reducing log file noise

2010-03-28 Thread Craig Falconer

Tom Munro Glass wrote, On 29/03/10 11:24:

On Mon, 29 Mar 2010 11:19:33 Craig Falconer wrote:

Tom Munro Glass wrote, On 29/03/10 11:11:

Mar 28 22:56:50 localhost init: Id "ACM0" respawning too fast: disabled
for 5 minutes



Your problem is that init is bringing up the process and failing.  Not
that its logging too much.


Thanks Craig - I figured that was the problem. Is there a way of making init 
quieter? Associated with this, is there a way of changing the disabled period 
from 5 minutes?


I think you're patching the symptom, not the cause.  init's job to to 
make sure certain processes are running.


Perhaps udev is your answer instead of init - if the modem is found then 
run something, otherwise don't.



--
Craig Falconer



Re: Reducing log file noise

2010-03-28 Thread Solor Vox
I'd suggest using a udev rule that runs simple script to enable/disable your
tty.  All you'd need to do is match your modem in a udev rule and call a
script to change your inittab.

That way it only runs if/when the modem is plugged-in.

Cheers,
sV



On 29 March 2010 11:10, Tom Munro Glass  wrote:

> A client is deploying several CentOS machines to remote sites, some of
> these
> have broadband access but some use dial-up for remote administration. Part
> of
> the standard configuration is to install a USB modem driver and to add the
> following line to /etc/inittab:
>
> ACM0:2345:respawn:/sbin/mgetty -x 0 -n 6 -D ttyACM0
>
> to allow us to dial into the machine.
>
> This is fine *IF* the USB modem is physically installed and being used, but
> on
> sites using broadband where a modem is not usually installed
> /var/log/messages
> fills up with a large amount of the following:
>
> Mar 28 22:56:50 localhost mgetty[4828]: mod: cannot open line /dev/ttyACM0:
> Input/output error
> Mar 28 22:56:50 localhost mgetty[4828]: open device /dev/ttyACM0 failed:
> Input/output error
> Mar 28 22:56:50 localhost mgetty[4828]: cannot get terminal line
> dev=ttyACM0,
> exiting: Input/output error
> Mar 28 22:56:50 localhost init: Id "ACM0" respawning too fast: disabled for
> 5
> minutes
>
> Similar messages are also written to /var/log/mgetty.log.ttyACM0.
>
> You might think the obvious solution is to not set up the modem if it's not
> being used, but this isn't what the client wants. The CentOS machine is
> headless, and in the event of a broadband failure we need an engineer to be
> able to simply plug in a modem to give us remote access to it.
>
> So, is there some way of reducing the amount of messages ending up in the
> log
> files? I have already added '-x 0' to minimise output from mgetty but the
> messages shown above are still getting through.
>
> Tom Munro Glass
>
>


Re: Reducing log file noise

2010-03-28 Thread Tom Munro Glass
On Mon, 29 Mar 2010 11:19:33 Craig Falconer wrote:
> Tom Munro Glass wrote, On 29/03/10 11:11:
> > Mar 28 22:56:50 localhost init: Id "ACM0" respawning too fast: disabled
> > for 5 minutes
> 
> Your problem is that init is bringing up the process and failing.  Not
> that its logging too much.

Thanks Craig - I figured that was the problem. Is there a way of making init 
quieter? Associated with this, is there a way of changing the disabled period 
from 5 minutes?

Tom


Re: Reducing log file noise

2010-03-28 Thread Craig Falconer

Tom Munro Glass wrote, On 29/03/10 11:11:
Mar 28 22:56:50 localhost init: Id "ACM0" respawning too fast: disabled for 5 
minutes


Your problem is that init is bringing up the process and failing.  Not 
that its logging too much.




--
Craig Falconer