Skip to content

Instantly share code, notes, and snippets.

@Pesticles
Created May 16, 2014 00:01
Show Gist options
  • Save Pesticles/a55344812cf1b9081ada to your computer and use it in GitHub Desktop.
Save Pesticles/a55344812cf1b9081ada to your computer and use it in GitHub Desktop.
#!/bin/bash
#
# Checks the remote storage is mounted and tries to remount it if it's not.
# Once it's mounted, move any images waiting from the temporary local storage
# to the remote share.
# Is it mounted?
if ! mount | grep -q '/DATA'; then
# Try to mount
sudo mount -a
# Is it mounted
if ! mount | grep -q '/DATA'; then
# Exit
echo "NOT MOUNTED!!"
exit 1
fi
fi
# Move files
if [[ $( ls -1 /home/pi/temp/ | wc -l ) -gt 0 ]]; then
mv /home/pi/temp/*.jpg /DATA/Timelapse/
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment