What I thought was going to be very simple has turned out to be really lame, and so I come to you for help.
mountedon=`df -k /synctest | awk 'NR == 2 {print $1}'`
if [ $mountedon -ne "ids4:/nex02/synctest" ]
then
# mount /pupcl06
mountedon=`df -k /synctest | awk 'NR == 2 {print $1}'`
if [ $mountedon -ne "ids4:/nex02/synctest" ]
then
mailx -s "nightly sync FAILED - check drive mountings" name@email.com name2@email.com << EOH
drive 'synctest' is not mounted properly.
EOH
echo mounting error
break
else
echo successfully mounted
# wmsynctest
fi
else
echo was previously mounted
# wmsynctest
fi
echo yerp
Note: lines are commented out because I don't want this to actually do anything yet.
Basically, I'm trying to check to see if a drive is mounted properly. If it is, execute another script. If not, try to mount it. If that fails, kill the process. If it succeeds, execute another script.
When I run this program, I get an unexpected end of file error. I'm assuming it's related to the nested ifs because of similar errors I read about online.
So if you know how to get around this problem with the ifs, please let me know. Thank you.