I am looking for "something" that runs scripts/programs in my user context as a reaction to signals seen on the system(!) DBus.

I'd imagine the best solution looking and working a lot like cron:

  • With the actual cron, users specify requirements for running commands in terms of dates and times in crontabs and whenever the requirements are met the respective commands are run.
  • With my dbus-cron users would specify requirements in terms of bus instances, object paths, interfaces, members (for now, I'd settle for these) and whenever the requirements are met, the respective commands are run.

Is there anything available that does something along these lines?

I remember, once upon a time, I could specify services and policies in ~/.dbus that would activate if specific messages were sent to the dbus instance, but that was before systemd and I have no idea how/if systemd works.

How this question came to be

I want to use the buttons on my flatbed scanner to scan documents, i.e. I put a document into the scanner, hit a button on the scanner and as a result I get a PDF in my (current) home directory, which is a scan of the document.

Why this is a problem

I am using scanbd to catch button-pushed-events from my flatbed scanner, because that is what Debian ships with (at the moment) and this seems to be a common tool for this task.

Scanbd is a daemon running as root and it can run scripts on events and also publishes button-pushed-events as signals to the system DBus.

I need to catch these signals to start the scanning, processing and filing as my user (and in my $HOME). The scanning and everything that follows after that works fine. There are enough tools available. The problem is tying those tools to pushing a button on the scanner.

I found two approaches to this task:

However, both approaches require my user to start some process at some early point in time, when my user session starts. This process would run forever and has to be cleaned up at The Right Moment(TM) and so on and so forth. In short, there is a lot of overhead to be built around the above mentioned approaches, which I would like to avoid. I am not able to find an implementation of this available.

Final remarks

  • As a temporary workaround I just have the scans put in a public place and manually bulk fetch them from there at the end of the day.

  • I can envision a script that checks which user currently has the unlocked session with a local XServer and drops privileges to that user.

  • I guess multi-seat systems would need some sort of semaphore on the scanner?!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.