SCP自动拷贝文件
#!/bin/bash
# this program is used to upload file; only one parameter
# $1 is file name
# this program is used to upload file; only one parameter
# $1 is file name
file_name="/home/www/htdocs/test/App/Html/$1"
#echo "befor $file_name" >> /tmp/test.log
#check whether file exist
if [ ! -f "$file_name" ]; then
echo "file $file_name is not exist"
exit 0
fi
echo $file_name
#echo "after $file_name" >> test.log
ip="192.168.1.10"
port=22
username="root"
scp -r -P $port $file_name $name@$ip:$file_name
#change own
ssh -p $port $username@$ip "chown www:www $file_name"