Dealing with Bad Address On ACD Mount In Linux

Every now and then while attempting to access my mounted Amazon Cloud Drive I would receive the error message “Bad Address”. To fix this issue I copied a script I had found on Reddit  called This script is set to run every minute in crontab, it attempts to list the mounted folder and if it fails, it will attempt to remount the Amazon Cloud Drive.

I’m currently using this setup as a READ ONLY drive.

I adjusted the code to work with my encfsplex and acd_cli setup.

echo "Remount Initiated $(date)"
appname=$(basename $0)

# Change this to the location of your Amazon Cloud Mountpoint

if [ $(ls -l $acdmount  | grep -v '^total' | wc -l) -gt 0 ]; then
    echo Everything Looks ok

if [ $(ps -Al | grep $appname | wc -l) -gt 2 ]; then
        echo "Already Running! Count $(ps -Al | grep $appname | wc -l)"
echo "Remounting $(date)"

# umount -f "$acdmount"

echo "Unmounting"
/usr/local/bin/acd_cli umount /home/plex/e
/usr/local/bin/acd_cli umount /home/plex/cloud

echo "Deleting"
rm -rf /home/plex/cloud
rm -rf /home/plex/e

echo "Making"
mkdir /home/plex/cloud
mkdir /home/plex/e

syncresult=$(/usr/local/bin/acdcli sync 2>&1)
if [ $(echo $syncresult | grep -i error | wc -l) -gt 0 ]; then
        echo Error with the DB
        rm ~/.cache/acd_cli/nodes.db
        /usr/local/bin/acdcli sync
        sleep 10
echo $syncresult

/usr/local/bin/acd_cli mount /home/plex/e

ENCFS6_CONFIG='/home/plex/encfs.xml' encfs --extpass="ENCFS PASS" /home/plex/e/ /home/plex/cloud/

echo "Remount Done $(date)"


Crontab Code

*/1 * * * * /path/ > /path/fixmount.log 2>&1

The only thing missing is a function to check if is running too long.