Hi,
I am having this script:
Code:
HOST="***.***.***.***"
USER="***"
PASS="***"
EXEC=$(expect -c "
spawn sftp -o \"BatchMode no\" -b /home/portal/bin/xymon-backup-cmd $USER@$HOST
expect \"password:\"
send \"$PASS\r\"
interact
")
echo "$EXEC"
cd /var/www/html/xymon-backup
mv bb-hosts bb-hosts_`date -I`
xymon-backup-cmd has the following commands in it:
Code:
lcd /var/www/html/xymon-backup
cd server/etc
get bb-hosts
exit
If I run it from the CL, it works and it saves the bb-hosts file to the "/var/www/html/xymon-backup" dir.
But if run by cron, it does not work.
Could you help me please?
Thank you.
George.