some bugfixes in automounter

This commit is contained in:
mmaster 2021-09-22 04:32:45 +02:00
parent 59b67f6d68
commit 5c88fc2203
1 changed files with 9 additions and 2 deletions

View File

@ -3,7 +3,8 @@
mountpoint="/media/video" ### var: mountpoint
mountoptions="ro" ### var: mountoptions
device="sda1" ### var: mount device
player="randomvideo.sh" ### var: player process
playersh="randomvideo.sh" ### var: playerscript process
player="vlc" ### var: player process
if [ ! -d "$mountpoint" ]; then
sudo mkdir $mountpoint
@ -28,8 +29,14 @@ while true; do
elif [ -z "$dev_plug_state" ] && [ ! -z "$dev_mount_state" ]; then
echo "/dev/$device is not plugged in and is mounted on $mountpoint"
playerstat="$(pgrep $player)"
playershstat="$(pgrep $playersh)"
if [ ! -z "$playershstat" ]; then
echo "Terminating $playersh"
pkill $playersh
echo "Done!"
fi
playerstat="$(pgrep $player)"
if [ ! -z "$playerstat" ]; then
echo "Terminating $player"
pkill $player