Инструменты пользователя

Инструменты сайта


sh:upload2ftp

Загрузка файла на FTP

Вариант #1

upload2ftp.sh

#!/bin/sh
local_filename="/home/user/some_file"
remote_filename="some_file"
hostname="hostname"
username="username"
password="password"
ftp -un $hostname <<EOF
quote USER $username
quote PASS $password
binary
put $local_filename $remote_filename
quit
EOF

Вариант #2

# functions 'ftp_upload'
ftp_upload(){
        backup_file=$1
        /usr/bin/ftp -inv -P 2121 <<EOF
        open $ftp_host
        user $ftp_user $ftp_pass
        binary
        mkdir $year
        cd $year
        mkdir $month
        cd $month
        mkdir $day
        cd $day
        put $backup_file $new_file_name
        bye
EOF
}
sh/upload2ftp.txt · Последние изменения: 2014/02/19 17:32 — Alex