correctly using gconftool in cron job to control Workrave (was: adjusting Gconf key /apps/workrave/timers/daily_limit/auto_reset behaves bizarrely)

Joe Wells <[email protected]> Sun, 20 Jan 2013 11:02:36 +0000
Newsgroups gmane.comp.misc.workrave.user
Message-ID <[email protected]>
Dear Workrave gurus,

Never mind, I have found the cause of the weird happenings mentioned
in the e-mail I just sent which is quoted below.

I have determined that the problem I was seeing is because gconftool-2
has changed from using ORBit in my old version of Ubuntu to using
D-Bus in the latest long-term Ubuntu version which I am using now.
This meant that I needed to set the environment variable
DBUS_SESSION_BUS_ADDRESS to the correct value in cron jobs.  So now I
look up the Workrave process ID and extract the value of
DBUS_SESSION_BUS_ADDRESS from /proc/PID/environ.  I just now have
started using something like the following /bin/sh command in my cron
job which fixes the problem completely:

    export DBUS_SESSION_BUS_ADDRESS="$(cat /proc/"$(pidof workrave)"/environ | perl -0 -n -e 'm/^DBUS_SESSION_BUS_ADDRESS=(.*)/ && print "$1"')"

The command above is simplified from my actual code.

Maybe this information will help someone else who wants to use a cron
job to manipulate Workrave settings.

With my best wishes,

Joe

Joe Wells <[email protected]> writes:

> I've recently switched to Workrave 1.9.4, having previously used 1.8.5
> for a long time.
>
> With the newer Workrave, I'm getting quite weird behavior when I
> adjust the Gconf key /apps/workrave/timers/daily_limit/auto_reset.
>
> For example, if I have been running for a long time with the value of
> this key being 3600 (1 hour), and I then set it to 2, then Workrave
> does not appear to notice.  The next time the keyboard/mouse is
> considered idle for 2 seconds, the timer is not reset as it should be.
>
> I've played some more with this and also have seen sometimes a
> different strange behavior where setting this key to 2 and then to
> 3600 results in the timer resetting after 2 seconds of idleness,
> despite Gconf reporting that the key's value is 3600.
>
> I haven't yet worked out the precise pattern to the strangeness, but
> it seems clear that there is some kind of bug.
>
> Any suggestions?
>
> -- 
> With my best regards,
>
> Joe

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012