View previous topic :: View next topic |
Author |
Message |
nsoveiko n00b
Joined: 04 Dec 2004 Posts: 53 Location: somewhere over the rainbow
|
Posted: Tue Sep 12, 2023 5:34 pm Post subject: Xfce4: xfconf-query in cron jobs [SOLVED] |
|
|
i have a cron job that makes sure at the end of the day display is not in 'presentation mode' and will turn off:
Code: | DISPLAY=:0.0 /usr/bin/xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -r |
it worked just fine for years, yet after the last weekly update started producing an error message
Code: | Failed to init libxfconf: Error spawning command line “dbus-launch --autolaunch=f96e26d71d8266a68564f69c619b2617 --binary-syntax --close-stderr”: Child process exited with code 1. |
the exact same command still works fine from the command line. but not from crontab.
in the list of updated packages the only two things that could be remotely connected to X are
x11-themes/elementary-xfce-icon-theme-0.18
x11-misc/sddm-0.20.0-r1
xfce-base/xfconf has not been updated in 3 months.
i'm at a loss here, what happened and how to fix it?
Last edited by nsoveiko on Fri Sep 15, 2023 3:58 am; edited 1 time in total |
|
Back to top |
|
|
Banana Moderator
Joined: 21 May 2004 Posts: 1742 Location: Germany
|
|
Back to top |
|
|
nsoveiko n00b
Joined: 04 Dec 2004 Posts: 53 Location: somewhere over the rainbow
|
Posted: Tue Sep 12, 2023 6:28 pm Post subject: |
|
|
Banana wrote: | my google foo tells me it could be something use related. | xfce-base/xfconf use flags (or any related to xfce) have not changed in years. i actually suspect something went missing from the environment. the environment in which cron jobs are executed is very, very basic.
Quote: | Does the cron runs as the same user as the started X/xfce session? | yes |
|
Back to top |
|
|
nsoveiko n00b
Joined: 04 Dec 2004 Posts: 53 Location: somewhere over the rainbow
|
Posted: Fri Sep 15, 2023 3:57 am Post subject: |
|
|
nsoveiko wrote: | i actually suspect something went missing from the environment. the environment in which cron jobs are executed is very, very basic. |
so i've traced the problem to missing DBUS_SESSION_BUS_ADDRESS in cron jobs environment. after some googling, the following solution appears to work with xfce-base/xfce4-power-manager-4.19.1
Code: | #!/bin/bash
# turns off 'presentation mode' in xfce, resuming display power management
# first, set up the environment for the cron job
export DISPLAY=:0.0
# from https://coldfix.eu/2018/10/09/dbus-cronjob/
display=0
machine=$(cat /etc/machine-id)
session=~/.dbus/session-bus/${machine}-${display}
source $session
export DBUS_SESSION_BUS_ADDRESS
/usr/bin/xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -r |
|
|
Back to top |
|
|
|