Fixed mount point for a USB cardreader (Raspberry Pi, UDEV)

Hey all! :slight_smile:

I'm trying to create a fixed mount point for an usb cardreader.
I've found a script on a raspberry pi forum which does the following:

usb stick is plugged in -> script checks the mount point for data -> script starts copying the files automatically -> script unmounts the stick/partition.

The problem is: The script is using a fixed mountpoint. the author of the script can do that because he is always using the same camera with the same partition name (GOPRO). I want to use that script to copy files from many different cameras and many different manufacturers.

BUT i will always use the same cardreader (which has a unique serial i could use)

Thats the script im referring to:

UDEV rule (50-sdcopy.rules)

# Run Script as a new process when any device is added
KERNEL=="sd[a-z]", SUBSYSTEM=="block", ACTION=="add", RUN+="/bin/su root -c /opt/bin/myfork.sh"

Then the myfork.sh script

#!/bin/bash
date >> myfork.log
setsid /opt/bin/goprosync.sh > setsid.log 

This script is necessary (myfork.sh simple runs a new process that is disconnected from the calling script. Otherwise udev would kill long file transfers).

And here the actual copy script.

#!/bin/bash

# If the script detects the existence of both the source and destination disks
# then the contents ot the GOPRO folder is synchronised with files on the BACKUPDISK folder.
# Ensure that the Partition Label's on all your devices are set accordingly.

## Make sure the script isn't already running from a previous disk connection
################################################################################
if [ `ps -e | grep -c $(basename $0)` -gt 2 ]; then exit 0; fi
################################################################################

sleeptime=5
logfile=/opt/bin/goprosync.log
source=/media/GOPRO
destination=/media/BACKUPDISK
SourceCounter=20
DestinationCounter=20
Recipient=user1@raspberrypi.local
Sender=goprosync@raspberrypi.local
Subject=GoProSync_Result

# Start a new log file and Add the  email stuff to the top
############################################################
echo "To: "$Recipient > $logfile
echo "From: "$Sender >> $logfile
echo "Subject: "$Subject >>$logfile
exho " " >>$logfile
echo "==============" >> $logfile
echo "Script Started" >> $logfile
date >> $logfile

# Test if the Source disk is connected.
until [ $SourceCounter -lt 1 ]
do
   echo $SourceCounter >> $logfile
   if [ -d $source ]
   then
      echo "== Source Disk Found - Look for the Destination Disk ==" >>$logfile
      date >> $logfile
      let SourceCounter=0

      # Test if the Destination disk is connected.
      until [ $DestinationCounter -lt 1 ]
      do
         echo $DestinationCounter >> $logfile
         if [ -d $destination ]
         then
            echo "== Destination Disk Found - GOPRO Backup Started ==" >> $logfile
            rsync -avzh $source $destination >> $logfile 2>&1
            echo "Backup Complete" >> $logfile
            echo "Unmount the  USB  disks" >> $logfile
            umount $source >> $logfile 2>&1
            umount $destination >> $logfile
            date >> $logfile
            echo "== GoPro Copy Complete ==" >> $logfile
            let DestinationCounter=0
         else
            echo "== Looking for the Destination Disk ==" >>$logfile
            sleep $sleeptime
         fi
         let DestinationCounter=DestinationCounter-1
      done

   else
      echo "== Looking for the Source Disk  ==" >>$logfile
      sleep $sleeptime
   fi
   let SourceCounter=SourceCounter-1
done

echo "Script Complete" >> $logfile
echo "===============" >> $logfile
# Send the log as an email
ssmtp user1@raspberrypi < $logfile

What i want to do:

The card reader should be always mounted at the same mount point (/media/cardreader).

How could i do that?
Add something to the 50.sdcopy.rules? Add something to the script?

Thanks in advance!!!

Kind regards
niko