Solved

Gconf configuration

Posted on 2011-03-06
2
452 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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
The purpose of this article is to show how we can create Linux Mint virtual machine using Oracle Virtual Box. To install Linux Mint we have to download the ISO file from its website i.e. http://www.linuxmint.com. Once you open the link you will see …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

810 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