From 56cd5869493596b478b50211ca8ff7f25d199a8d Mon Sep 17 00:00:00 2001 From: Guy Resheff Date: Fri, 4 Apr 2025 02:24:23 +0000 Subject: [PATCH] navy files for mounting /mnt/media through tailscale --- .../system/docker.service.d/override.conf | 7 +++++++ .../systemd/system/mnt-media-monitor.service | 13 +++++++++++++ .../etc/systemd/system/mnt-media-monitor.timer | 11 +++++++++++ navy/etc/systemd/system/mnt-media.mount | 18 ++++++++++++++++++ 4 files changed, 49 insertions(+) create mode 100644 navy/etc/systemd/system/docker.service.d/override.conf create mode 100644 navy/etc/systemd/system/mnt-media-monitor.service create mode 100644 navy/etc/systemd/system/mnt-media-monitor.timer create mode 100644 navy/etc/systemd/system/mnt-media.mount diff --git a/navy/etc/systemd/system/docker.service.d/override.conf b/navy/etc/systemd/system/docker.service.d/override.conf new file mode 100644 index 0000000..c64b28a --- /dev/null +++ b/navy/etc/systemd/system/docker.service.d/override.conf @@ -0,0 +1,7 @@ +[Unit] +After=mnt-media.mount +Wants=mnt-media.mount + + +[Service] +TimeoutStartSec=30 diff --git a/navy/etc/systemd/system/mnt-media-monitor.service b/navy/etc/systemd/system/mnt-media-monitor.service new file mode 100644 index 0000000..899e161 --- /dev/null +++ b/navy/etc/systemd/system/mnt-media-monitor.service @@ -0,0 +1,13 @@ +# /etc/systemd/system/mnt-media-monitor.service +[Service] +Type=oneshot +ExecStart=/usr/bin/systemctl restart mnt-media.mount +[Unit] +Description=Persistent NFS Mount Watcher +After=mnt-media.mount + +[Service] +Type=oneshot +ExecStart=/bin/sh -c 'if ! mountpoint -q /mnt/media; then systemctl restart mnt-media.mount; fi' +Nice=19 +IOSchedulingClass=idle diff --git a/navy/etc/systemd/system/mnt-media-monitor.timer b/navy/etc/systemd/system/mnt-media-monitor.timer new file mode 100644 index 0000000..9454f76 --- /dev/null +++ b/navy/etc/systemd/system/mnt-media-monitor.timer @@ -0,0 +1,11 @@ +[Unit] +Description=30s Mount Check Timer + +[Timer] +OnBootSec=1min +OnUnitActiveSec=30s +AccuracySec=1s +RandomizedDelaySec=0 + +[Install] +WantedBy=timers.target diff --git a/navy/etc/systemd/system/mnt-media.mount b/navy/etc/systemd/system/mnt-media.mount new file mode 100644 index 0000000..60bbfde --- /dev/null +++ b/navy/etc/systemd/system/mnt-media.mount @@ -0,0 +1,18 @@ +[Unit] +Description=Persistent NFS Media Share via Tailscale +After=tailscaled.service systemd-resolved.service network-online.target +Requires=tailscaled.service +ConditionPathExists=/var/run/tailscale/tailscaled.sock +ConditionPathExists=/run/systemd/resolve/stub-resolv.conf +StartLimitIntervalSec=0 + +[Mount] +What=sdb-share:/mnt/sdb/media +Where=/mnt/media +Type=nfs +Options=_netdev,noatime,soft,timeo=30,retrans=5,retry=0,proto=tcp,vers=4.2,fg +TimeoutSec=30 +LazyUnmount=true + +[Install] +WantedBy=multi-user.target