Update to Phil Wright solution, for a more general context
1 - Create a udev rules file '/etc/udev/rules.d/61-sr-change.rules' and add the line :
KERNEL=="sr*", ACTION=="change", RUN+="/usr/local/bin/sr_change.sh %n"
2 - And create the script '/usr/local/bin/sr_change.sh' :
#!/bin/sh
if [ $# -eq 1 ] then source=/dev/sr$1 else source=/dev/sr0 fi
dvd+rw-mediainfo $source > /dev/null n=$?
if [ "$n" -eq '251' ] then umount $source fi exit 0
Update to Phil Wright solution, for a more general context
1 - Create a udev rules file '/etc/udev/ rules.d/ 61-sr-change. rules' and add the line :
KERNEL=="sr*", ACTION=="change", RUN+="/ usr/local/ bin/sr_ change. sh %n"
2 - And create the script '/usr/local/ bin/sr_ change. sh' :
#!/bin/sh
if [ $# -eq 1 ]
source= /dev/sr$ 1
source= /dev/sr0
then
else
fi
dvd+rw-mediainfo $source > /dev/null
n=$?
if [ "$n" -eq '251' ] then
umount $source
fi
exit 0