#!/bin/bash

#source /opt/scripts_local/shared_functions.sh

#[[ $EUID != 0 ]] && echo "sudo required!" && exit
#[[ $(pidof -x "$(basename "$0")" -o %PPID) ]] && echo "Already running, exiting..." && exit 1
# Loop until tailscale service is up and connected

until [ $(mount |awk '{print $3}'| grep -w "$1") != '' ]
do
  echo "sleep"
  sleep 2
done

bindfs --force-user="2222" --force-group="3333" --perms="0770" "/srv/nfs/downloads" "/media/downloads"

until [ $(mount |awk '{print $3}'| grep -w "$1") != '' ]
do
  echo "sleep"
  sleep 2
done

bindfs --force-user="2222" --force-group="3333" --perms="0770" "/srv/nfs/move" "/media/move"