Solved

Gconf configuration

Posted on 2011-03-06
2
433 Views
Last Modified: 2012-05-11
I'd like to set some gconf preferences via cron or script. What's the best way to do this apart from making changes to the XML configuration file directly? I know /usr/bin/gconftool-2 does not work via cron (not easily anyway).

Here's an example of what I'm trying to do:

/usr/bin/gconftool-2 --type int --set /apps/gnome-power-manager/timeout/sleep_display_ac 0
/usr/bin/gconftool-2 --type string --set /apps/gnome-power-manager/buttons/power shutdown

Any thoughts or ideas?

OS is Ubuntu squeeze/sid.
0
Comment
Question by:Julian Matz
2 Comments
 
LVL 7

Accepted Solution

by:
unSpawn earned 500 total points
ID: 35124185
If I recall correctly the problem is with with gconftool-2 requiring access to D-BUS and X authority
This is how a BASH shell script (to be run as cron job) may look like:

#!/bin/sh --
# Export the D-BUS socket address:
export $(env | grep DBUS_SESSION_BUS_ADDRESS)
# Export X auth cookie file name:
export $(env | grep XAUTHORITY)
/usr/bin/gconftool-2 --type int --set /apps/gnome-power-manager/timeout/sleep_display_ac 0
/usr/bin/gconftool-2 --type string --set /apps/gnome-power-manager/buttons/power shutdown
# Verify the result by running the appropriate 'gconftool-2 -g' commands:
/usr/bin/gconftool-2 g /apps/gnome-power-manager/timeout/sleep_display_ac
/usr/bin/gconftool-2 -g /apps/gnome-power-manager/buttons/power
# as this outputs to stdout check your email if cron is so configured.
exit 0

* Do test running it from an unprivileged user account.
** If it doesn't work then I won't know why unfortunately.
0
 
LVL 21

Author Closing Comment

by:Julian Matz
ID: 35316338
Thanks.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

If you use Debian 6 Squeeze and you are tired of looking at the childish graphical GDM login screen that is used by default, here's an easy way to change it. If you've already tried to change it you've probably discovered that none of the old met…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now