Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Gconf configuration

Posted on 2011-03-06
2
Medium Priority
?
483 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

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 …
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
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.:
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

715 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