Sample Header Ad - 728x90

Cannot automate with cron the changing of the configuration with dconf on Debian (it worked on Ubuntu)?

0 votes
1 answer
81 views
This script worked in adjusting the background color and the font color in gnome-terminal when run from cron on Ubuntu 22.04 LTS.
#!/bin/bash

detect_dstr() {
  distribution=$(grep -E '^ID=' /etc/os-release | awk -v FS='=' '{print $2}')
    
    if [ "$distribution" == "debian" ]; then
        echo "debian"
    elif [ "$distribution" == "ubuntu" ]; then
        echo "ubuntu."
    else
        echo "unknown"
    fi 
}

chng_t_drk() {
    dconf write /org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/background-color "'#000000'"
    dconf write /org/gnome/terminal/legacy/profiles:/:b1dcc9dd-5262-4d8d-a863-c897e6d979b9/foreground-color "'#ffffff'"
}
chng_t_lght() {

}

h=$(date +%-H) 
if [[ "$h" -gt 16 ]]; then chng_t_drk
elif [[ "$h" -gt 4 &&  "$h" -lt 16 ]]; then chng_t_lght; fi
unset h
I am now on a Debian-stable-based distribution that utilizes sysvinit and this script no longer works from cron. The theme changes when I manually execute it, though. Even specifying the display does not help: */10 * * * * DISPLAY=:0 ~/gnome-terminal/change-theme.sh I checked with dconf-editor and the ID is the same on Ubuntu 22.04, Debian Testing(trixie) and on Antix (based on Debian Stable). Why is it then that I cannot automate of changing the configuration on the latter two distros?
Asked by John Smith (827 rep)
Feb 8, 2024, 08:03 PM
Last activity: Feb 9, 2024, 06:00 PM