0

I have a script that downloads the Bing images and then sets the background. This script is running in anacron daily, so its run as root. Now it changes the background for root but not for user. How can I make it change the background for the user?

# Set the GNOME3 wallpaper
DISPLAY=:0 GSETTINGS_BACKEND=dconf gsettings set org.gnome.desktop.background picture- uri '"file://'$saveDir$picName'"'

# Set the GNOME 3 wallpaper picture options
DISPLAY=:0 GSETTINGS_BACKEND=dconf gsettings set org.gnome.desktop.background picture-options $picOpts`
2
  • 1
    Does it absolutely need to run as root for some reason? Do you need it to change the background for root as well as the user?
    – dobey
    Mar 14, 2013 at 23:49
  • Actually, I just wanted to run anacron. Meaning once daily. If I could do that as a user that would be even better.
    – Sina
    Mar 15, 2013 at 19:44

1 Answer 1

1

You don't need to set up a cron job as root. You can simply run crontab -e as the user you want to run the job as, and configure the job to run once daily for that user. It will then run for that user, and you can just delete the cron job for the root user.

6
  • However this only works if my computer is not running all the time. That is what I want to use anachron.
    – Sina
    Mar 16, 2013 at 15:09
  • What do you mean? The cron used in Ubuntu is anacron. You could also just run a script when you log in instead.
    – dobey
    Mar 16, 2013 at 20:51
  • Yes. But anacron scripts as always run as root. Or if not, how do I run anacron as user?
    – Sina
    Mar 18, 2013 at 13:46
  • No. Anacron runs programs as the user that owns the crontab in question. Everything is not run as root.
    – dobey
    Mar 18, 2013 at 14:20
  • Oh cool. How do I set that up, that a job runs once daily regardless when my computer is on?
    – Sina
    Mar 19, 2013 at 15:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .