Adjust usb-detect for Raspberry Pi

This commit is contained in:
Ruben Hartenstein (PEA4-Fe) 2021-03-05 13:21:11 +00:00
parent d4e4ff64cb
commit 7a325ec7de
2 changed files with 9 additions and 3 deletions

View File

@ -1 +1 @@
ACTION=="add", KERNEL=="sd[b-z]1", SUBSYSTEM=="block", RUN+="/home/kske/usb.sh" ACTION=="add", KERNEL=="sd[a-z]1", SUBSYSTEM=="block", RUN+="/home/pi/git/opus-data/usb-detect/usb-detect.sh"

View File

@ -11,7 +11,10 @@ LOGFILE=/var/log/usb-detect.log
exec &>> $LOGFILE exec &>> $LOGFILE
# Processing function (file name is passed as parameter) # Processing function (file name is passed as parameter)
PROCESS_FUNC=cat PROC_FUNC="Rscript /home/pi/git/opus-data/OpusData.R"
# Directory inside which the processing function is run
PROC_DIR="/home/pi/git/opus-data/"
echo "USB device detected at $DEVNAME" echo "USB device detected at $DEVNAME"
@ -30,7 +33,10 @@ for f in $MOUNTPOINT/*.[0-9]
do do
found=1 found=1
echo "Processing $f..." echo "Processing $f..."
$PROCESS_FUNC $f (
cd $PROC_DIR
$PROC_FUNC $f
) || echo "Failed executing $PROC_FUNC $f in $PROC_DIR"
echo "Removing $f..." echo "Removing $f..."
rm $f rm $f
done done