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.
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
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!