I have two servers in my network and I transfer some of the data from one server to the other. I wrote a script to accomplish this and it works fine when I run it manually. However, when I include it in crontab in order to automate the process, it will not mount the external server even though the script runs. I send as much info to a log as possible but, no mount errors are reported, just the fact that it did not connect.
This is the script:
#!/bin/bash
LOGFILE="/var/log/SRV1.log"
echo $(date +%Y-%m-%d_%H:%M:%S)" --- Begins Now" | tee -a ${LOGFILE}
StartTime="$(date +%s)"
echo "Connecting to SRV1" | tee -a ${LOGFILE}
mount.cifs //192.168.1.200/share /media/SVR1 -o user=username,pass=pwd | tee -a ${LOGFILE}
The file is owned by root:root with 755 permissions. (I know I could tighten that up but, I'm still just experimenting).