aboutsummaryrefslogtreecommitdiff
path: root/scripts/automount-clean
blob: eff3cc994231bb875859518a2bd027bdea689e6f (plain)
1
2
3
4
5
6
7
8
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