initial
This commit is contained in:
commit
1235f4b353
24
dlna_bind.sh
Executable file
24
dlna_bind.sh
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
error_exit() {
|
||||||
|
>&2 echo "$@"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
[ -z "$1" ] && error_exit "usage: $0 file_or_directory_path"
|
||||||
|
|
||||||
|
bind_root=/media/minidlnad
|
||||||
|
name="$(basename "$1")"
|
||||||
|
mountpoint="$bind_root/$name"
|
||||||
|
|
||||||
|
[ -e "$mountpoint" ] && error_exit "error: mountpoint $bind_root/$name already exists"
|
||||||
|
|
||||||
|
if [ -f "$1" ]; then
|
||||||
|
touch "$mountpoint"
|
||||||
|
elif [ -d "$1" ]; then
|
||||||
|
mkdir "$mountpoint"
|
||||||
|
fi
|
||||||
|
|
||||||
|
mount --bind "$1" "$mountpoint"
|
4
dlna_restart.sh
Executable file
4
dlna_restart.sh
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
systemctl stop minidlna
|
||||||
|
rm /var/cache/minidlna/files.db
|
||||||
|
systemctl start minidlna
|
19
dlna_unbind_all.sh
Executable file
19
dlna_unbind_all.sh
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
bind_root="/media/minidlnad"
|
||||||
|
|
||||||
|
if [ -z "$(ls $bind_root)" ]; then
|
||||||
|
>&2 echo "directory $bind_root is empty"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
for f in $bind_root/*; do
|
||||||
|
if umount "$bind_root/$(basename "$f")"; then
|
||||||
|
rm "$bind_root/$(basename "$f")"
|
||||||
|
echo "[ OK ] $f"
|
||||||
|
else
|
||||||
|
echo "[FAIL] $f"
|
||||||
|
fi
|
||||||
|
done
|
Loading…
x
Reference in New Issue
Block a user