I made a simple bash script that changes the wallpaper for a random picture from my wallpapers directory using pcmanfm. It's something like that:
#!/bin/bash
pcmanfm -w "$(find /home/likewise-open/MAPS/lucas.cardeal/Pictures/Wallpapers -type f | shuf -n1)"
I want that automatically, so u put the script on crontab. But it has no effect when its called by crontab. What's wrong with my script? How can I fix it?
Thanks
That script will give you a X11 authorization error when is set as cron job. To prevent this, just add
export DISPLAY=:0
andexport XAUTHORITY=/home/username/.Xauthority
(changeusername
with your user name) in your script:ADDENDUM: An update caused the above script to break in Lubuntu 16.04 and above. See this stackoverflow answer https://stackoverflow.com/a/46259031/5895207 for the additional environment variable that needs to be specified in the script.