Last active
January 7, 2016 11:16
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 $* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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