My ACD mount goes down every now and again. This is the Python script I use to check if the mount is down and remount. It’s very basic and no variables are used, so edit and use as you see fit.
# basic script for restarting acd mount on failure and notifying via pushbullet,
# hardcoded and not great but whatever, note this mounts read-only, change to suit your needs
# put this in your crontab to run every 5 minuntes
# */5 * * * * python /home/user/acdmountdown.py > /dev/null
from pushbullet import Pushbullet
import os
import subprocess
import logging
logging.basicConfig(filename='acdmount.log', level=logging.INFO, format='%(asctime)s %(levelname)s %(message)s')
logging.info('ACD mount checker started')
DEVNULL = open(os.devnull, 'wb')
pb = Pushbullet('YOUR_PUSHBULLET_KEY')
#If the mount is available, this check will return True.
exists = os.path.exists("/home/kamos/acd/cloud.encrypted/t-sYFZuyBZHfi1XTJr8lcgqP")
if exists is not True:
logging.warning("ACD mount is down")
push = pb.push_note("ACD mount down", "attempting restart")
logging.info("attempting umount")
subprocess.call(["/usr/local/bin/acd_cli", "umount"], stdin=None, stdout=DEVNULL)
logging.info("attempting ACD mount")
subprocess.call(["bash", "/home/kamos/acd/mount.sh"], stdin=None, stdout=DEVNULL)
logging.info("running ACD sync")
subprocess.call(["/usr/local/bin/acd_cli", "sync"], stdin=None, stdout=DEVNULL)
if os.path.exists("/home/kamos/acd/cloud.encrypted/t-sYFZuyBZHfi1XTJr8lcgqP") is not True:
push = pb.push_note("ACD mount still down", "attempting node.db delete")
logging.warning("ACD mount is still down, attempting node.db delete")
subprocess.call(["rm", "/home/kamos/.cache/acd_cli/nodes.db"], stdin=None, stdout=DEVNULL)
logging.info("running ACD sync")
subprocess.call(["/usr/local/bin/acd_cli", "sync"], stdin=None, stdout=DEVNULL)
logging.info("attempting ACD mount")
subprocess.call(["bash", "/home/kamos/acd/mount.sh"], stdin=None, stdout=DEVNULL)
elif os.path.exists("/home/kamos/acd/cloud.encrypted/t-sYFZuyBZHfi1XTJr8lcgqP"):
push = pb.push_note("ACD mount back up", "restart successful")
logging.info("ACD mount restart succeeded")
else:
logging.info('ACD mount is up')
Basic logic here is:
check if the Mount is up:
If not, unmount, remount and sync.
Check if mount is up:
If not, delete nodes.db, sync and remount.
I might move over to rclone if it proves to be more stable.