You are not logged in.

#1 2017-04-23 14:44:04

DopustimVladimir
Member
From: Bishkek (Kyrgyzstan)
Registered: 2017-04-23
Posts: 9

XFCE4 How to set the wallpaper using cron

Here is a script and it works, but fails to run with cron:

#!/bin/bash
xfconf-query -c xfce4-desktop \
    -p /backdrop/screen0/monitor0/workspace0/last-image \
    -s /home/user/Pictures/wallpaper.png

But the cronie does not want to execute it (for example, notify-send works good).

Log:

CMDOUT (Failed to init libxfconf: Using X11 for dbus-daemon autolaunch was disabled at compile time, set your DBUS_SESSION_BUS_ADDRESS instead.)

I suppose it's a problem with dbus.

Here is my question also:

http://stackoverflow.com/questions/4355 … using-cron

May be i have to use another tool, but interesting - what's a trouble?

Thanks!

Last edited by DopustimVladimir (2017-04-23 15:00:10)


Web oriented programmer

Offline

#2 2017-04-23 18:11:36

seth
Member
Registered: 2012-09-03
Posts: 51,056

Offline

#3 2017-04-24 06:44:34

DopustimVladimir
Member
From: Bishkek (Kyrgyzstan)
Registered: 2017-04-23
Posts: 9

Re: XFCE4 How to set the wallpaper using cron

DISPLAY=:0 is not working for this task in my Arch (and Debian 8.7 too). Is it working for you? Notify-send works fine


Web oriented programmer

Offline

#4 2017-04-24 07:01:35

seth
Member
Registered: 2012-09-03
Posts: 51,056

Re: XFCE4 How to set the wallpaper using cron

Did you read the "set your DBUS_SESSION_BUS_ADDRESS" part of the error?
I don't use xfce, but would assume

export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$UID/bus

would be required and do - you can probably also analyze the /proc/$PID/env of the xfce session process and fetch the accurate value from there.

Offline

#5 2017-04-24 07:52:11

DopustimVladimir
Member
From: Bishkek (Kyrgyzstan)
Registered: 2017-04-23
Posts: 9

Re: XFCE4 How to set the wallpaper using cron

I tried this also https://askubuntu.com/a/811104 and it is not helps


Web oriented programmer

Offline

#6 2017-04-24 08:02:54

seth
Member
Registered: 2012-09-03
Posts: 51,056

Re: XFCE4 How to set the wallpaper using cron

if you exported the DBUS_SESSION_BUS_ADDRESS as suggested in that thread as well, you'll not have gotten the error from your initial post (anymore) ...

Offline

#7 2017-04-24 08:35:02

DopustimVladimir
Member
From: Bishkek (Kyrgyzstan)
Registered: 2017-04-23
Posts: 9

Re: XFCE4 How to set the wallpaper using cron

It is not working, because i can't get D-BUS PID (/proc//environ) in my script when cronie started and i get an error again. Let me show you logs without translate from russian:

$ journalctl -b -u cronie

апр 24 14:22:15 arch crond[318]: (CRON) INFO (Syslog will be used instead of sendmail.)
апр 24 14:22:15 arch crond[318]: (CRON) INFO (RANDOM_DELAY will be scaled with factor 2% if used.)
апр 24 14:22:15 arch crond[318]: (CRON) INFO (running with inotify support)
апр 24 14:22:16 arch crond[324]: pam_unix(crond:session): session opened for user vladimir by (uid=0)
апр 24 14:22:16 arch crond[323]: pam_unix(crond:session): session opened for user vladimir by (uid=0)
апр 24 14:22:16 arch CROND[326]: (vladimir) CMD (/usr/local/bin/test_wallpaper)
апр 24 14:22:16 arch CROND[325]: (vladimir) CMD (/usr/local/bin/test_backup)
апр 24 14:22:17 arch CROND[324]: (vladimir) CMDOUT (grep: /proc//environ: Нет такого файла или каталога)
апр 24 14:22:15 arch systemd[1]: Started Periodic Command Scheduler.
апр 24 14:22:17 arch CROND[324]: (vladimir) CMDOUT (Ошибка инициализации libxfconf: Using X11 for dbus-daemon autolaunch was disabled at compile time, set your DBUS_SESSION_BUS_ADDRESS inste
апр 24 14:22:17 arch CROND[324]: pam_unix(crond:session): session closed for user vladimir
апр 24 14:22:19 arch CROND[323]: pam_unix(crond:session): session closed for user vladimir

Last edited by DopustimVladimir (2017-04-24 08:36:26)


Web oriented programmer

Offline

#8 2017-04-24 08:41:26

DopustimVladimir
Member
From: Bishkek (Kyrgyzstan)
Registered: 2017-04-23
Posts: 9

Re: XFCE4 How to set the wallpaper using cron

For example, i can do this by terminal and bingo:

xfconf-query -c xfce4-desktop \
    -p /backdrop/screen0/monitor0/workspace0/last-image \
    -s /home/vladimir/Pictures/wallpaper.png

And cronie works fine with notify-send without any exported DISPLAY=:0 and other things...


Web oriented programmer

Offline

#9 2017-04-24 15:56:08

seth
Member
Registered: 2012-09-03
Posts: 51,056

Re: XFCE4 How to set the wallpaper using cron

Yeah "/proc//environ" desperately lacks some number between the two slashes - ideally the one of the xfce-session process.
What does your enriched job look like? (including any scripts you call in there to accomplish the task of dbus socket resolution)

Offline

Board footer

Powered by FluxBB