I am trying to set up crontab to run a script that will pick a random image from a folder and set it as my wallpaper in the morning, and another script that will do the same thing at night.
Goal is to have a random day and night wallpaper.
Got everything to work for a while by following the instructions from this post.
With this code:
#!/bin/bash
DIR="/path/to/wallpapers/"
PIC=$(ls $DIR/* | shuf -n1)
PID=$(pgrep gnome-session);
export DBUS_SESSION_BUS_ADDRESS=$(grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2-);
gsettings set org.gnome.desktop.background picture-uri "file://$PIC"
But my wallpaper just stopped updating after a day or so. I just tried setting cron to run this script every minute in an attempt to troubleshoot it (since that had worked in my tests before), but it just won't update my wallpaper anymore...
Does anyone know what could be the issue? Or know a better way/script to do it?
This is the full error message:
grep: /proc/1069: Is a directory
grep: 1501/environ: No such file or directory
(process:11303): dconf-CRITICAL **: 23:22:01.548: unable to create file '/home/user/.cache/dconf/user': Permission denied. dconf will not work properly.
(process:11303): dconf-CRITICAL **: 23:22:01.548: unable to create file '/home/user/.cache/dconf/user': Permission denied. dconf will not work properly.
(process:11303): dconf-CRITICAL **: 23:22:01.549: unable to create file '/home/user/.cache/dconf/user': Permission denied. dconf will not work properly.
(process:11303): dconf-WARNING **: 23:22:01.549: failed to commit changes to dconf: The given address is empty
Thanks in advance
-- Running Ubuntu 18.04