IgnorantGuru's Blog

Linux software, news, and tips

devmon Rewritten

The devmon script introduced below has been rewritten. The new version should work without modification and adds some new features. And my thanks to Bernard Baeyens for some nice bash 4 code borrowed from his udisksvm script.

devmon is a configuration-less bash wrapper script for udisks which automounts optical discs and removable drives. It can also selectively autostart apps or execute commands after mounting, ignore specified devices and volume labels, and unmount removable drives.

udisks has the advantage that it works directly through udev and policykit, requires no configuration or udev/rules.d changes, and does not require HAL. You simply install udisks using your package manager, then run devmon to enable auto-mounting. udisks allows you to mount and unmount drives as a normal user.

The aim for this version of devmon was to make it a simple yet flexible automounting solution. Here are some possible ways you can use it:

Automounter
With a single command added to your startup script, you have automounting – when CD/DVDs or removable drives are inserted they are immediately mounted to /media. It can also unmount all removable drives with one command so they are safe to remove.

Autostarter
By adding a few options on the command line, devmon becomes an autostarter which can start apps based on the media type, or run other commands you specify. For example, when you insert a DVD video, it can play automatically.

Custom Uses
Using only command-line options, devmon gives you almost complete control over what happens when devices are added. You can run custom scripts or commands, or inhibit automounting to handle that yourself as well. devmon takes care of the device events, allowing you to design a custom automounting solution.

If you encounter any problems, please let me know so I can try to address them – thanks.

devmon Instructions

January 27, 2011 Posted by | Scripts | Comments Off on devmon Rewritten