#!/bin/bash
# --->這是學籍系統目錄的上一層
sfs3updir=/var/www
sfs3dir=/var/www/sfs3
tmpdir=kwrklf2153468412045115
downloadsfs3updatefile=
echo 切換到 $sfs3updir 目錄
cd $sfs3updir
# --->建立 暫存目錄
echo 建立暫存目錄 $tmpdir
mkdir $tmpdir
echo 進入 暫存目錄 $tmpdir
cd $tmpdir
echo 開始下載 更新檔 http://sfscvs.tc.edu.tw/sfs_stable5.tar.gz
wget -c http://sfscvs.tc.edu.tw/sfs_stable5.tar.gz
echo 開始 解開 sfs_stable5.tar.gz
tar zxvf sfs_stable5.tar.gz >> $sfs3updir/update_sfs3.log
echo 進入 sfs3_stable/ 目錄
cd sfs3_stable/
echo 開始將更新檔的檔案複蓋到 $sfs3dir
cp * /var/www/sfs3/ -baf
echo 回到 sfs3 的上一層目錄
cd ../..
echo 把暫存目錄 $tmpdir 刪除
rm $tmpdir -rf
echo 更新完成!
echo 開始刪除 重複檔案
cd $sfs3dir
find .|grep \~ |xargs rm
echo 刪除完成!