[Lubuntu] Capture "wall" messages for display on desktop?

John Hupp lubuntu at prpcompany.com
Sat Oct 27 21:06:42 UTC 2012


On 10/27/2012 3:50 PM, John Hupp wrote:
>
> On 10/27/2012 1:36 AM, Jonathan Marsden wrote:
>> John,
>>
>> On 10/26/2012 04:52 PM, John Hupp wrote:
>>
>>> The only problem is that it only posts warning messages to the
>>> wall command, which outputs only to console sessions.  ...
>> In my experience, apcupsd is a *lot* more configurable than that -- did
>> you read its documentation or its scripts before posting?
>>
>> You can create scripts for each class of event (onbattery, offbattery,
>> etc.) handled by /etc/apcupsd/apccontrol that do *whatever* you want
>> them to do -- turn the message into audio and speak it using a speech
>> synth, if you really want :)
>>
>> You don't even need to edit /etc/apcupsd/apccontrol to do this, it will
>> notice that your custom scripts exist, and use them instead of its
>> internal default actions.
>>
>> Jonathan
>>
>>
> [Newbie sent scurrying to dig into the "Customizing Event Handling" 
> section of the apcupsd manual, and for some general research on 
> desktop notificationmethods.]
>
> OK, I found out that notify-send is a common desktop notification 
> tool, and that one installs the libnotify-bin package to get it.  I 
> did so.
>
> I have now also created the shell script /etc/apcupsd/annoyme. It is 
> owned by root. I used the Properties: Permissions sheet to give 
> everyone Read & Write permission, and marked it executable.
>
> The contents of annoyme:
>     #!/bin/sh
>     notify-send -u critical -t 5000 "The computer is running on 
> battery." "It will shut down shortly. Please save your work and log off."
>     exit 0
>
> Running this script manually pops up a nice warning on the desktop for 
> 5 seconds.
>
> But when I pull the plug for a UPS test, I do not get any desktop 
> warnings, though apcupsd powers down the PC when expected. But if I 
> log into a console during that time, I see the default onbattery and 
> annoyme wall messages.  As I understand it, apccontrol should run my 
> custom annoyme script before running its own default annoyme command.
>
> I have not modified apccontrol.
>
> Anyone recognize what the problem is?
>
> --------------------------
> I could add parameters from my current configured-for-testing 
> apcupsd.conf:
>
> UPSCABLE usb
> UPSTYPE usb
> DEVICE
> LOCKFILE /var/lock
> SCRIPTDIR /etc/apcupsd
> PWRFAILDIR /etc/apcupsd
> NOLOGINDIR /etc
>
> ONBATTERYDELAY 6
> BATTERYLEVEL 5
> MINUTES 3
> TIMEOUT 60
> ANNOY 10
> ANNOYDELAY 20
> NOLOGON always
> KILLDELAY 0
>
> NETSERVER on
> NISIP 0.0.0.0
> NISPORT 3551
> EVENTSFILE /var/log/apcupsd.events
> EVENTSFILEMAX 10
>
> UPSCLASS standalone
> UPSMODE disable
>
> STATTIME 0
> STATFILE /var/log/apcupsd.status
> LOGSTATS off
> DATATIME 0

A further test: From a terminal command line I ran:

     /etc/apcupsd/apccontrol "annoyme" "" 1 0

And my notify-send desktop notification displayed as envisioned.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/lubuntu-users/attachments/20121027/da979d36/attachment.html>


More information about the Lubuntu-users mailing list