Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm using a script based on the work posted here: Update pidgin status using cron

I'm trying to make a wicd script that automaticly disconnects before Wifi-disconnect and reconnects on Wifi-reconnect.

But somehow dbus/pidgin can't seem to find the dbus session, eventhough the environment variable is set.

My setup:

  • Arch linux
  • Pidgin 2.9.0
  • Libpurple 2.9.0-2

Autoload script (runs on Xfce start):

#!/bin/bash
touch /tmp/dbus_session_data
env | grep DBUS_SESSION_BUS_ADDRESS > /tmp/dbus_session_data
echo 'export DBUS_SESSION_BUS_ADDRESS' >> /tmp/dbus_session_data

The tmp-file after runnign script:

[skaverat@eeepthought ~]$ cat /tmp/dbus_session_data 
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-gZMqzhdS2S,guid=9b8b3169f14346902127832000000043
export DBUS_SESSION_BUS_ADDRESS

Okay, let's get into another environment:

[root@eeepthought ~]# env | grep DBUSD
[root@eeepthought ~]# source /tmp/dbus_session_data 
[root@eeepthought ~]# env | grep DBUS
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-gZMqzhdS2S,guid=9b8b3169f14346902127832000000043
[root@eeepthought ~]# purple-remote getstatus
No existing libpurple instance detected.

purple-remote call in normal environment:

[skaverat@eeepthought ~]$ purple-remote getstatus
available

Any idea what could be wrong?

share|improve this question

2 Answers 2

DBus session can't be shared for different users, that's how it was designed.

I might not get your current solution, why're you trying to do it with root?

If so, use su - USERNAME -c /path/to/this/script.sh to launch a script like this,

#!/bin/bash
. ~/.dbus/session-bus/*
purple-remote getstatus

This will work for the root user.

P.S: why wouldn't you set up the cron as the user who loggined through pidgin??

share|improve this answer

You can't, as far as I am aware connect to another users D-Bus session. So root@eeepthought, being a different user, was refused permission to connect to the D-Bus session of skaverat@eeepthought. That is all that is wrong with what you've done.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.