Results 1 to 2 of 2

Thread: Cannot use gsettings set to work with cron, anacron, or autostart

  1. #1
    Join Date
    Nov 2007
    Location
    Iowa
    Beans
    9
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Question Cannot use gsettings set to work with cron, anacron, or autostart

    I am trying to "lock down" the computer by running a script at boot that turns lock on, lock screen after 10 min and require password, etc. I am using Ubuntu 12.04

    I have tried editing crontab, anacrontab as well as rc.local to either run my script or actually inserted the code from the script into the files and I cannot get anything to work.

    Any ideas?

    * this is the only way I can get the commands to run in a script manually *

    Code:
    (su - $(logname) -c "gsettings set org.gnome.desktop.screensaver lock-enabled true")
    
    (su - $(logname) -c "gsettings set org.gnome.desktop.screensaver lock-delay 600")
    
    (su - $(logname) -c "gsettings set org.gnome.desktop.screensaver ubuntu-lock-on-suspend true")
    
    (su - $(logname) -c "gsettings set org.gnome.desktop.screensaver user-switch-enabled false")
    * These commands work if entered into terminal manually *

    Code:
    gsettings set org.gnome.desktop.screensaver lock-enabled true
    gsettings set org.gnome.desktop.screensaver lock-delay 600
    gsettings set org.gnome.desktop.screensaver ubuntu-lock-on-suspend true
    gsettings set org.gnome.desktop.screensaver user-switch-enabled false
    I also tried inserting the following code from other posts about using gsettings in cron with no luck:

    Code:
    DISPLAY=:0 
    GSETTINGS_BACKEND=dconf
    sessionfile=`find "${HOME}/.dbus/session-bus/" -type f`
    export `grep "DBUS_SESSION_BUS_ADDRESS" "${sessionfile}" | sed '/^#/d'`
    Also I double checked my script was executable and created /home/username/.config/autostart/screenlock.desktop:

    Code:
    [Desktop Entry]
    Type=Application
    Exec=/path/screenlock.sh
    Terminal=False
    Hidden=true
    NoDisplay=true
    X-GNOME-Autostart-enabled=true
    Name[en_US]=screen lock
    Name=screen lock

  2. #2
    Join Date
    Feb 2005
    Location
    Melbourne, Australia
    Beans
    13,505
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Cannot use gsettings set to work with cron, anacron, or autostart

    Quote Originally Posted by hackaxle View Post
    I am trying to "lock down" the computer by running a script at boot that turns lock on, lock screen after 10 min and require password, etc. I am using Ubuntu 12.04

    I have tried editing crontab, anacrontab as well as rc.local to either run my script or actually inserted the code from the script into the files and I cannot get anything to work.
    .
    http://ubuntuforums.org/showthread.php?t=185993
    Regards, David.
    Please use the Forum search and Wiki search for immediate help
    Please mark your thread as Solved when appropriate
    New to technical forums?: How To Ask Questions The Smart Way

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •