一個代碼遠程同步shell腳本

#!/bin/bash

###遠程主機路徑
remote_path=59.110.165.127:/home/

###當前主機路徑
current_path=/app/rsync_test


###同步方法
rsync_process(){

    rsync -vtr $current_path $remote_path

}


###輸入參數驗證
if [ $1 = 'y' ]

then

    echo "開始傳輸"

    rsync_process

    echo "傳輸完畢"

elif [ $1 = 'n' ]

then

    echo "不傳輸"

else

    echo "參數錯誤"

fi

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章