Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Xfce4: xfconf-query in cron jobs [SOLVED]
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
nsoveiko
n00b
n00b


Joined: 04 Dec 2004
Posts: 53
Location: somewhere over the rainbow

PostPosted: Tue Sep 12, 2023 5:34 pm    Post subject: Xfce4: xfconf-query in cron jobs [SOLVED] Reply with quote

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
View user's profile Send private message
Banana
Veteran
Veteran


Joined: 21 May 2004
Posts: 1405
Location: Germany

PostPosted: Tue Sep 12, 2023 6:14 pm    Post subject: Reply with quote

my google foo tells me it could be something use related.
Does the cron runs as the same user as the started X/xfce session?
_________________
My personal space
My delta-labs.org snippets do expire

PFL - Portage file list - find which package a file or command belongs to.
Back to top
View user's profile Send private message
nsoveiko
n00b
n00b


Joined: 04 Dec 2004
Posts: 53
Location: somewhere over the rainbow

PostPosted: Tue Sep 12, 2023 6:28 pm    Post subject: Reply with quote

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
View user's profile Send private message
nsoveiko
n00b
n00b


Joined: 04 Dec 2004
Posts: 53
Location: somewhere over the rainbow

PostPosted: Fri Sep 15, 2023 3:57 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum