View Single Post
kstep's Avatar
Posts: 18 | Thanked: 52 times | Joined on Dec 2010
#1
Hello, all!

I was missing for simple dbus scheduler for a long time (dbus-scripts is a no op for me for some reasons), so I created my own dbuscron daemon to monitor DBUS events and run commands on them.

The source code lies on github at http://github.com/kstep/dbuscron and deb-package can be taken from my blog at http://kstep.me/dbuscron_en.html.

The main idea of the scheduler is simple: it's just like good old cron but for DBUS messages. It's configured with /etc/dbuscrontab file in a crontab-like format. Here're some simple examples from my own config:

Code:
# bus(*S*ystem/*s*session) message_type(signal|method_call|method_return|error) source interface object_path member destination arguments command
# Stop player on headphones plug out
S signal * org.freedesktop.Hal.Device /org/freedesktop/Hal/devices/platform_headphone Condition * ButtonPressed;connection grep -q disconnected /sys/devices/platform/gpio-switch/headphone/state && run-standalone.sh /opt/userscripts/mpcontrol.sh stop
# Connect to ISP via PPTP on home WiFi network connection
S signal * com.nokia.wlancond.signal /com/nokia/wlancond/signal connected * wlan0 run-standalone.sh /opt/userscripts/tasks/connect-pptp.sh
# Disconnect PPTP
S signal * com.nokia.wlancond.signal /com/nokia/wlancond/signal disconnected * wlan0 run-standalone.sh /opt/userscripts/tasks/disconnect-pptp.sh
# Forward all notifications to my notebook via SSH (sic!)
s method_call * org.freedesktop.Notifications /org/freedesktop/Notifications SystemNoteInfoprint,Notify * * /opt/userscripts/tasks/whitebook-notify.sh
I can give you a lot of such examples and using them is as easy as adding new line in config and sending HUP to dbuscron daemon to make it reread this config. I think this example tells you more than thousand words, and if not, you can read more about it at http://kstep.me/dbuscron_en.html, as there're too many options to mention all of them here (and actually I have wrote so much about it in my blog, I got a little tired of describing all of them, sorry =).

As of stability, I run it on my N900 all the time for several weeks and haven't mentioned any critical bugs (and if I do, I will not wait to fix them asap, as I'm the main user of this program).

P.S. If you are interested in some of my scripts mentioned in this example, I can provide them as well (except private parts with passwords etc. of cause =).
 

The Following 14 Users Say Thank You to kstep For This Useful Post: