Ver Fonte

reworked media_change

Karl há 3 anos atrás
pai
commit
f13ac8b350
1 ficheiros alterados com 4 adições e 1 exclusões
  1. 4 1
      media_change.sh

+ 4 - 1
media_change.sh

@@ -11,9 +11,10 @@ lsblk | grep $device
 
 if [ $? -eq 0 ]; then
     echo "$(date) Device exists on machine."
-    echo "$(date) Mounting device $1 to /mnt/floppy."
+    echo "$(date) Forcing unmount of floppy"
     /usr/bin/systemd-mount --umount /mnt/floppy
     echo "$(date) Floppy unmounted"
+    echo "$(date) Mounting floppy "
     /usr/bin/systemd-mount $1 /mnt/floppy
     echo "$(date) Floppy mounted"
     var=$(cat /mnt/floppy/diskplayer.contents)
@@ -22,5 +23,7 @@ if [ $? -eq 0 ]; then
 else
     echo "$(date) Device does not exist on machine."
     runuser -l pi -c "python3 /home/pi/pythonDiskPlayer/player.py stop"
+    echo "$(date) Forcing unmount of floppy"
+    /usr/bin/systemd-mount --umount /mnt/floppy
 fi
 echo "$(date) End."