1

I wrote a bash script to change my wallpaper automatically on Ubuntu 20.04 and it works well, but when I'm trying to automate it with crontab it doesn't work, the wallpaper isn't changing.

Here is my script :

#!/bin/bash
DIR="/home/mbz/Wallpapers"
PIC=$(find $DIR -type f -maxdepth 1 2>/dev/null | shuf -n1)
gsettings set org.gnome.desktop.background picture-uri "file://$PIC"

after typing crontab -e, i put in the end of the file the line below to change it very 1mn

* * * * * cd /home/mbz/Desktop/ && bash ba.sh

But, it's not changing the wallpaper !

dsfdf
  • 11
  • 1
  • why not just use? the crontab -e: * * * * * bash /home/mbz/Desktop/ba.sh and; also, It was long ago I used ubuntu, but I think a name (username) is needed too somewhere? (If I'm not mistaken!) – William Martens Oct 05 '20 at 17:11
  • 1
    it's not working. what username ? – dsfdf Oct 05 '20 at 17:17
  • Sorry, gonna explain: If it is what I think it is; * * * * * bash /home/mbz/Desktop/ba.sh Or, take a look at this one; (not really related to the question but, more related to the cron code) https://askubuntu.com/questions/1278880/schedule-shutdown-every-day-on-ubuntu-20-04/1278885#1278885 – William Martens Oct 05 '20 at 17:18
  • 1
    Already looked on that topic, also adding the username has no effect. – dsfdf Oct 05 '20 at 17:23
  • Oh, I'm sorry; I thought it was something like that, but, anyway I don't really know anymore.. Hopefully someone expert in scripting can solve this? :/ – William Martens Oct 05 '20 at 17:24

0 Answers0