Xfce Forum

Sub domains
 

You are not logged in.

#1 2016-02-11 14:58:54

der_eismann
Member
Registered: 2016-02-11
Posts: 1

Logout XFCE via Cron fails with “Could not get owner of name”

I am currently trying to make Xubuntu logout when the user is idle for 2 mins. However this doesn't work. I use the command xfce4-session-logout --logout which works perfectly from the command line, but when using cron I get the error

Could not get owner of name 'org.xfce.session manager' No such Name

I guess there is some environment variable missing or something like that, but Google didn't find anything. Can you help?

Best regards,
Philipp

System: Raspberry Pi 2
OS: Xubuntu 15.10

Offline

#2 2016-02-11 17:51:51

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,948

Re: Logout XFCE via Cron fails with “Could not get owner of name”

cron doesn't have access to your user's X or dbus environments. Here is one way to get xfce4-session-logout to run from a cron job:

1. Add to the end of your ~/.bashrc file, the following command:

export | egrep "DBUS_SESSION_BUS_ADDRESS|DISPLAY" > ~/.xsession-export

2. Create a script to do the actual logout that incorporates those values:

#!/bin/bash
. $HOME/.xsession-export
/usr/bin/xfce4-session-logout

...and make the script executable.

3. Call this script from your cron job.


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

Board footer

Powered by FluxBB