1

I wrote a script to change the background file in Mate 17.04:

First, I once issued this command:

gsettings set org.gnome.desktop.background picture-uri file:///home/me/temp/background.jpg

Then I ran this script:

#/bin/bash
find -L ~/Pictures -name  '*.jpg'>~/jpegs.text
while true ; do
    convert `shuf -n 1 jpegs.text` -resize 1920x1080 ~/temp/background.jpg
    sleep 60
done

Worked beautifully until ??? After 20 minutes, system freezes. Pretty repeatedly. Proportionally faster if I reduce sleep time.

So I figured that it could be that writing into the background file while the system wanted to do something with it might be a problem. So I came up with this:

#/bin/bash
find -L ~/Pictures -name  '*.jpg'>~/jpegs.text
while true ; do
    convert `shuf -n 1 jpegs.text` -resize 1920x1080 ~/temp/backgroundtemp.jpg
    gsettings set org.gnome.desktop.background picture-uri file:///home/john/temp/backgroundtemp.jpg
    cp ~/temp/backgroundtemp.jpg ~/temp/background.jpg
    gsettings set org.gnome.desktop.background picture-uri file:///home/john/temp/background.jpg
    sleep 60
done

This version puts a new picture into the "temp" file, then tells gsettings to use that file. It then copies it to the "real" file and repoints gsettings to the "real" file so the next time it will not write into a file gsettings is using. Worked for hours! Wonderful! Then the system froze again.

Note, if the script is not running, the system does not freeze.

Am I doing something wrong? If so what. It is not the script, I believe. Possibly the interaction of repeated gsettings commands.

Edit: Forgot to mention. Freeze includes everything except mouse.

jpezz
  • 1,120

1 Answers1

0

Upgrade to 17.10 fixed it. No longer freezes when running script.

jpezz
  • 1,120