diff --git a/bash/convertHEICtoJPG.sh b/bash/convertHEICtoJPG.sh index 3717103..064e542 100755 --- a/bash/convertHEICtoJPG.sh +++ b/bash/convertHEICtoJPG.sh @@ -12,9 +12,16 @@ keeporiginals=1 # Set to 0 for PNG (much larger file size) saveasjpg=1 -# Make sure the mogrify command is available +# Make sure the mogrify command is available. If this is being +# run as a cron job the which command will fail so we check the +# default location just in case. which mogrify > /dev/null -[ $? -eq 1 ] && echo "Unable to run the mogrify command. Please follow the build and installation instructions at the top of the script to install the program on your system." && exit +if [[ $? -eq 1 ]]; then + if [[ ! -e "/usr/local/bin/mogrify" ]]; then + echo "Unable to run the mogrify command. Please follow the build and installation instructions at the top of the script to install the program on your system." + exit + fi +fi # Change into the folder with our images cd "$directory"