🎉 Project init
This commit is contained in:
parent
25aed8ce0f
commit
7056e232d7
4 changed files with 112 additions and 2 deletions
25
mount_nas.sh
Executable file
25
mount_nas.sh
Executable file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Automatically mount NFS share if NAs becomes available.
|
||||
# Restart jellyfin container after mounting.
|
||||
|
||||
DIR="/mnt/Medien"
|
||||
|
||||
ping 192.168.1.3 -c 1 > /dev/null 2>&1
|
||||
PING_STATUS=$?
|
||||
mount | grep "$DIR" > /dev/null 2>&1
|
||||
NAS_MOUNT=$?
|
||||
|
||||
if [ "$PING_STATUS" -eq 0 ]; then
|
||||
# Host reachable
|
||||
if [ "$NAS_MOUNT" -eq 1 ]; then
|
||||
# nout mounted yet
|
||||
mount "$DIR" && cd /opt/stacks/jellyfin/ && docker compose down && docker compose up -d
|
||||
fi
|
||||
else
|
||||
if [ $NAS_MOUNT -eq 0 ]; then
|
||||
# still mounted
|
||||
umount -l "$DIR"
|
||||
fi
|
||||
fi
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue