Solved

Gconf configuration

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
1. Introduction As many people are interested in Linux but not as many are interested or knowledgeable (enough) to install Linux on their system, here is a safe way to try out Linux on your existing (Windows) system. The idea is that you insta…
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.:

863 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

27 Experts available now in Live!

Get 1:1 Help Now