I have a pxe server which hosts a live image of Ubuntu 12.04 and I would like to enable VNC on it.
Normally I would do this with the following command:
$ gsettings set org.gnome.Vino enabled true
However, since this live OS lives in RAM it will need to do this on bootup every time. The problem is for some reason it will not work with a script in /etc/init.d/... For the life of me I cannot figure out why gsettings doesn't work in this context..
For reference this is the script I am using in /etc/init.d:
#!/bin/bash
log=/var/log/gsettings.log
#Needed for some reason.. received info from http://stackoverflow.com/questions/10374520/gsettings-with-cron
sessionfile=`find "${HOME}/.dbus/session-bus/" -type f`
export $(grep "DBUS_SESSION_BUS_ADDRESS" "${sessionfile}" | sed '/^#/d')
set_gsettings()
{
echo "Inside set_gsettings" >> $log
#Enable vino
gsettings set org.gnome.Vino enabled true 2>&1 >> $log
gsettings set org.gnome.Vino prompt-enabled false 2>&1 >> $log
}
case "$1" in
start)
echo "Inside IT-gsettings" >> $log
set_gsettings
;;
restart|reload|force-reload)
/etc/init.d/IT-gsettings start
;;
stop)
:
;;
*)
log_success_msg "Usage: /etc/init.d/IT-gsettings {start|stop|restart|reload|force-reload}"
exit 1
;;
esac
exit 0
In short, how can I set gsettings on startup?