Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a headless 10.04 server with a BD drive. I'd like to be able to insert a blu-ray or dvd into the drive and have the server immediately begin ripping it with makeMKV/Handbrake. Basically, I need command line way to run some arbitrary script/program as soon as a disc is put in.

Most of my Googling suggests that udev is the mechanism I should be able to use for this, but upon running sudo udevadm monitor --kernel I find that no udev events are generated when I put in a disc; only when I manually mount it.

I've also come across HAL, but it appears that it a) is now deprecated in favor of udev, and b) gets all its events from udev anyway (?). Nonetheless, I've given it a try (following this tutorial and replacing the author's reference to "dvdinsert" with the path to a short python script which runs wall to notify me that it was called), and have been unable to get HAL to run it when I put a CD in. I haven't figured out how to monitor HAL events as with udev, so I'm less sure that no events are actually happening-- the tutorial seems to suggest that they should. /var/log/syslog shows no complaints from HAL, though something showed up there when my .fdi file was malformed, so I know that's where HAL is writing messages to.

Has anyone been able to get CD/DVD/BD insertion events? Failing that, any udev/hal debugging tips would be appreciated.

Thanks!

EDIT: After some more reading/experimenting, I've got HAL calling a script on CD insertion. The problem was that HAL callouts cannot take absolute paths in the config (which I was doing); the scripts must explicitly live in /usr/lib/hal/scripts or /usr/bin.

I still have the problem, however, that hald does not run automatically at startup-- there does not seem to be anything HAL-related in /etc/init.d. (I'm going to file a new question for that specific problem).

Assuming I can solve that, this could work in a pinch, but I still feel like it's an ugly solution. HAL is still deprecated/unsupported, slows down the machine, and I'm not really sure what other things I might be screwing up by having it around in tandem with the new system. If anyone has a cleaner way to do this (or a solution to the startup problem), I'd love to hear it!

share|improve this question

closed as too localized by fossfreedom Mar 10 '12 at 16:31

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

    
I think dbus is your way to go, it is used by default on Ubuntu as far as I know. Take a look at the first answer to this question: stackoverflow.com/questions/5112298/… –  Wolter Hellmund Jan 25 '12 at 2:19
    
There is a tutorial on how to achieve almost exactly what you need using DBus. –  krlmlr Feb 4 '12 at 11:39
    
Are you still experiencing this issue? –  jrg Feb 26 '12 at 21:25
    
This question appears to be abandoned, if you are experiencing a similar issue please ask a new question with details pertaining to your problem. If you feel this question is not abandoned, please flag the question explaining that. :) –  Ringtail Feb 26 '12 at 22:10
add comment