Script Gsetting não está funcionando no cron job

1

eu escrevi um script para mudar automaticamente o tema do meu pc. O script funciona sem nenhum problema no terminal, mas quando eu coloco no cron, eu recebo esse erro

dconf-WARNING **: 02:52:01.932: failed to commit changes to dconf: Conncetion closed

Como posso consertar isso? Passei horas pesquisando, mas nada.

Este é o meu script:

AutoThemeSwithcer.sh 
#!/bin/bash 

CurrenTime="$(date +%H)"
NIGHT_TIME=7
DAY_TIME=8
DAY_THEME="Sierra-light"
NIGHT_THEME="Sierra-dark"
USER=robin994

NIGHT_IMAGE_PATH="/home/$USER/Immagini/mojave-night.jpg"
DAY_IMAGE_PATH="/home/$USER/Immagini/mojave-day.jpg"

CT=$(( 10#$CurrenTime-12 ))

if [ $CT -ge 0 ] 
    then
    if [ $CT -ge $NIGHT_TIME ] 
        then 
             gsettings set org.gnome.desktop.interface gtk-theme "$NIGHT_THEME"
             gsettings set org.gnome.desktop.interface gtk-theme "$NIGHT_THEME"
             gsettings set org.gnome.shell.extensions.user-theme name "$NIGHT_THEME"
             gsettings set org.gnome.desktop.background picture-uri "file://$NIGHT_IMAGE_PATH"

        else
             gsettings set org.gnome.desktop.interface gtk-theme "$DAY_THEME"
             gsettings set org.gnome.desktop.interface gtk-theme "$DAY_THEME"
             gsettings set org.gnome.shell.extensions.user-theme name "$DAY_THEME"
             gsettings set org.gnome.desktop.background picture-uri "file://$DAY_IMAGE_PATH"

    fi

elif [ $(( $CT + 12 )) -ge $DAY_TIME ] 
    then 
         gsettings set org.gnome.desktop.interface gtk-theme "$DAY_THEME"
         gsettings set org.gnome.desktop.interface gtk-theme "$DAY_THEME"
         gsettings set org.gnome.shell.extensions.user-theme name "$DAY_THEME"
         gsettings set org.gnome.desktop.background picture-uri "file://$DAY_IMAGE_PATH"
    else
         gsettings set org.gnome.desktop.interface gtk-theme "$NIGHT_THEME"
         gsettings set org.gnome.desktop.interface gtk-theme "$NIGHT_THEME"
         gsettings set org.gnome.shell.extensions.user-theme name "$NIGHT_THEME"
         gsettings set org.gnome.desktop.background picture-uri "file://$NIGHT_IMAGE_PATH"
fi
 

este é o meu arquivo cron:

Cron
#Borrowed from anacron
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/home/robin99$
#End borrowed from anacron


DISPLAY=:0
XAUTHORITY=/home/robin994/.Xauthority
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-qQv0mtFe42,guid=f0a53dfd4343da$
DBUS_SESSION_BUS_PID=14893

* * * * * bash -x AutoThemeSwitcher.sh > /home/robin994/bin/auto3.log 2$

Log file

++ date +%H
+ CurrenTime=02
+ NIGHT_TIME=7
+ DAY_TIME=8
+ DAY_THEME=Sierra-light
+ NIGHT_THEME=Sierra-dark
+ NIGHT_IMAGE_PATH=/home//Immagini/mojave-night.jpg
+ DAY_IMAGE_PATH=/home//Immagini/mojave-day.jpg
+ CT=-10
+ '[' -10 -ge 0 ']'
+ '[' 2 -ge 8 ']'
+ gsettings set org.gnome.desktop.interface gtk-theme Sierra-dark

(process:19539): dconf-WARNING **: 02:52:01.918: failed to commit changes to dconf: La connessione è chiusa
+ gsettings set org.gnome.desktop.interface gtk-theme Sierra-dark

(process:19543): dconf-WARNING **: 02:52:01.923: failed to commit changes to dconf: La connessione è chiusa
+ gsettings set org.gnome.shell.extensions.user-theme name Sierra-dark

(process:19547): dconf-WARNING **: 02:52:01.927: failed to commit changes to dconf: La connessione è chiusa
+ gsettings set org.gnome.desktop.background picture-uri file:///home//Immagini/mojave-night.jpg

(process:19551): dconf-WARNING **: 02:52:01.932: failed to commit changes to dconf: La connessione è chiusa
    
por Roberto Tortora 09.06.2018 / 02:48

0 respostas