#!/bin/bash
# NFS Mount Script for Tdarr Node on Calypso (DS723+)
# Location: /usr/local/etc/rc.d/tdarr-mounts.sh
#
# This script mounts the required NFS shares from Atlantis for Tdarr
# to access media files and the shared cache directory.
#
# Installation:
#   1. Copy this file to /usr/local/etc/rc.d/tdarr-mounts.sh
#   2. chmod +x /usr/local/etc/rc.d/tdarr-mounts.sh
#   3. Reboot or run manually
#
# Note: Synology DSM runs scripts in /usr/local/etc/rc.d/ at boot

# Wait for network to be ready
sleep 30

# Create mount points if they don't exist
mkdir -p /mnt/atlantis_media /mnt/atlantis_cache

# Mount NFS shares from Atlantis (192.168.0.200)
mount -t nfs 192.168.0.200:/volume1/data/media /mnt/atlantis_media -o rw,soft,nfsvers=3
mount -t nfs 192.168.0.200:/volume3/usenet/tdarr_cache /mnt/atlantis_cache -o rw,soft,nfsvers=3

# Verify mounts
if mountpoint -q /mnt/atlantis_media && mountpoint -q /mnt/atlantis_cache; then
    echo "Tdarr NFS mounts successful"
else
    echo "Warning: One or more Tdarr NFS mounts failed"
fi
