Adjust usb-detect for Raspberry Pi
This commit is contained in:
		@@ -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"
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,10 @@ LOGFILE=/var/log/usb-detect.log
 | 
			
		||||
exec &>> $LOGFILE
 | 
			
		||||
 | 
			
		||||
# 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"
 | 
			
		||||
 | 
			
		||||
@@ -30,7 +33,10 @@ for f in $MOUNTPOINT/*.[0-9]
 | 
			
		||||
do
 | 
			
		||||
	found=1
 | 
			
		||||
	echo "Processing $f..."
 | 
			
		||||
	$PROCESS_FUNC $f
 | 
			
		||||
	(
 | 
			
		||||
		cd $PROC_DIR
 | 
			
		||||
		$PROC_FUNC $f
 | 
			
		||||
	) || echo "Failed executing $PROC_FUNC $f in $PROC_DIR"
 | 
			
		||||
	echo "Removing $f..."
 | 
			
		||||
	rm $f
 | 
			
		||||
done
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user