Skip to content

Instantly share code, notes, and snippets.

@m0n5t3r
Last active January 7, 2016 11:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m0n5t3r/5a8fb29db6b117fd489b to your computer and use it in GitHub Desktop.
Save m0n5t3r/5a8fb29db6b117fd489b to your computer and use it in GitHub Desktop.
Script that pings Skype for Linux over DBus and alerts you if it's dead (it tends to just become unresponsive, not crash outright); intended to be run from cron every 5 minutes or so
#!/bin/bash
eval $(tr '\0' '\n' </proc/$(pidof gvfsd)/environ | grep DBUS_SESSION_BUS_ADDRESS)
eval $(tr '\0' '\n' </proc/$(pidof gvfsd)/environ | grep DISPLAY)
export DISPLAY DBUS_SESSION_BUS_ADDRESS
exec $*
#!/usr/bin/python
import os
import dbus
from dbus.mainloop.glib import DBusGMainLoop
dbus_loop = DBusGMainLoop()
bus = dbus.SessionBus(mainloop=dbus_loop)
try:
man = bus.get_object('com.Skype.API', '/com/Skype')
iface = dbus.Interface(man, 'com.Skype.API')
except:
os.system('/usr/bin/notify-send "Skype is ded"')
exit(0)
try:
iface.Invoke('NAME muie-skype')
except:
os.system('/usr/bin/notify-send "Skype is ded"')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment