0

i have three Centos server i want to schedule autobackup some directories to my FTP server ,FTP is already installed in all servers, i want to use crontab for schedule the backup but the SH files is not working ,i did the bellow configuration at ssh files

#!/bin/sh
ERNAME="user name of my ftp server"
PASSWORD="password of my ftp server"
SERVER="IP of my ftp server "

# local directory to pickup *.tar.gz file
FILE="/usr/log"

# remote server directory to upload backup
BACKUPDIR="/usr/backup"

# login to remote server
ftp -n -i $SERVER <<EOF
user $USERNAME $PASSWORD
cd $BACKUPDIR
mput $FILE/*.tar.gz
quit
EOF

but this configuration is not working.

  • Can you clarify what is not working – Romeo Ninov Jan 15 at 13:21
  • When i Run this SH file ,it is not backup my directories which i mentioned for backup – Sayed mustafa Jan 16 at 4:52
  • What happen if you execute commands one by one. I see you set variable ERNAME, not USERNAME – Romeo Ninov Jan 16 at 5:29
  • When i execute nothing is happen it not show any error ,but files is also not backuped – Sayed mustafa Jan 16 at 6:55
  • did you exec commands by hand? ON the same way they are in script, with variables and so on? Did you login successfully in to the server? – Romeo Ninov Jan 16 at 6:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.