linux簡單自動化指令碼

來源:互聯網
上載者:User

zip [參數] [檔案1] [檔案2]
把本目錄下的test檔案打包成test.zip檔案:zip test.zip test/* ,如果在檔案中用絕對的路徑,那麼在壓縮檔中也是絕對路徑。就是說,如果你 zip test.zip /home/test/* ,那麼在壓縮檔中也是這樣的層次關係。
      參數列表:
      -a     將檔案轉成ASCII模式
      -F     嘗試修複損壞的壓縮檔    
      -h     顯示協助介面
      -m     將檔案壓縮之後,刪除源檔案
      -n 特定字串    不壓縮具有特定字尾字串的檔案
      -o     將壓縮檔內的所有檔案的最新變動時間設為壓縮時候的時間
      -q     安靜模式,在壓縮的時候不顯示指令的執行過程
      -r     將指定的目錄下的所有子目錄以及檔案一起處理
      -S     包含系統檔案和隱含檔案(S是大寫)
      -t 日期     把壓縮檔的最後修改日期設為指定的日期,日期格式為mmddyyyy
      
unzip [參數] zip檔案
把本目錄下的test.zip檔案解壓:unzip test.zip
      參數列表:
      -l     列出壓縮檔所包含的內容
      -v     顯示詳細的執行過程

拋棄了以前藉助ant的簡單自動化,簡潔的shell實現:

# necessary env set
source /etc/bashrc
export DISPLAY=:1.0
export inetsoft_root=/src/sr10_0
export test_module=$inetsoft_root/newtest/designer
export file_name=`date +%Y\-%m\-%d`

# cvs update
cd $inetsoft_root/inetsoft
cvs up -dPC > $inetsoft_root/log/$file_name.log

# just compile java
cd $inetsoft_root/build
ant clean dcompile >> $inetsoft_root/log/$file_name.log

# automatic cases and generate report
cd $test_module
ant test report -s

# zip the reports generated
cd $test_module/reports
zip -rS $inetsoft_root/reports/$file_name.zip *

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.