aboutsummaryrefslogtreecommitdiff
path: root/scripts/automount-clean
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/automount-clean')
-rwxr-xr-xscripts/automount-clean9
1 files changed, 9 insertions, 0 deletions
diff --git a/scripts/automount-clean b/scripts/automount-clean
new file mode 100755
index 0000000..eff3cc9
--- /dev/null
+++ b/scripts/automount-clean
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+while sleep 10; do
+ find "/media/$USER" -mindepth 1 -maxdepth 1 -printf "%P\n" | while read -r mount; do
+ [ -n "$(lsblk | grep -F "$mount")" ] && continue
+ sudo fusermount -u "/media/$USER/$mount"
+ rmdir -v "/media/$USER/$mount"
+ done
+done