Pārlūkot izejas kodu

reworked media_change

Karl 3 gadi atpakaļ
vecāks
revīzija
f13ac8b350
1 mainītis faili ar 4 papildinājumiem un 1 dzēšanām
  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."