Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

shell script backup distant

#!/bin/sh
USERNAME="user"
PASSWORD="pass"
SERVER="123.456.78.90"
DATE="`date +%Y-%m-%d`"
BACKUPDIR="/${DATE}/accounts/"

find . -type f -name "*.tar.gz" -exec basename {} ; |
  while read filename ; do 
    ftp -inv $SERVER >> /tmp/My_ftp_backup.log <<EOF
user $USERNAME $PASSWORD
cd $BACKUPDIR
binary
put $filename
EOF
    echo -e "$date copied $filename
" >> /tmp/My_ftp_backup.log
done
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #shell #script #backup #distant
ADD COMMENT
Topic
Name
9+9 =