Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Gconf configuration

Posted on 2011-03-06
2
Medium Priority
?
486 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 2000 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 Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

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 …
In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
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…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month10 days, 14 hours left to enroll

886 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