Golfreeze.packetlove.com: Life style of Golfreeze Canon400D Family kammtan.com Jazz Freebsd Unix Linux System Admin guitar Music
All about unix linux freebsd and FAQ for Packetlove.com Web hosting , Mail hosting , VoIP + IP PBX server => command , shell script ,tool , crontab => Topic started by: golfreeze on มกราคม 24, 2011, 11:33:03 am
-
#####################
#Script FTP to another host.
#####################
#!/bin/sh
HOST="122.122.122.122"
USER="insertlogin"
PASSWD="insertpassword"
FILE="mydatabase.sql"
LOCATION="/Library/Webserver/Websites/localsite/mydatabase.sql"
ftp -n $HOST <<EOF
quote USER $USER
quote PASS $PASSWD
binary
#ดึงไฟล์มา
get $FILE $LOCATION
#วางไฟล์
put $FILE $LOCATION
quit
EOF
exit 0
-
ในกรณีถ้าเครื่องนั้นไม่มี ftp client ถ้าในตระกูล redhat 64 bit
ลองเชคที่
ROOT#less /etc/yum.conf
# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d
exclude=apache* httpd* mod_* mysql* MySQL* mariadb* da_* *ftp* exim* sendmail* php* bind-chroot*
เอาในส่วนของ *ftp* ออกแล้วทำการ
#yum install ftp.x86_64
เท่านี้ก็เรียบร้อยแล้วครับผม
-
$ cat numbers.txt
1
2
3
4
5
6
7
8
9
10
$ sum=0; while read num ; do sum=$(($sum + $num)); done < numbers.txt ; echo $sum
55