2009年5月7日 星期四

AT –t `date +%m%e%H%M`

因為每次做緊急配信失敗重傳都容易忘記,所以現在決定用at排程自動執行:

tfmd> at -t 05072235
rsh TIA1 -l tfm "/u1/tfm/comm/shell/recalldxq.sh X"
echo `date +%m%e%H%M` $status " TIA1 recalldxq.sh" >> taskX.log

<Ctrl D>
Job tfm.1241706900.a will be run at Thu May  7 22:35:00 TAIST 2009.

解釋一下,用at –t $time指定時間執行指令,下一行就是指令內容,然後用$status取得執行是否成功( 0 ) 寫入紀錄檔taskX.log,最後鍵入Ctrl + D結束這段 at指令稿

tfmd> at -t 05072335
rsh TIA1 -l tfm "/u1/tfm/comm/shell/recalldxq.sh X"
echo `date +%m%e%H%M` $status " TIA1 recalldxq.sh" >> taskX.log
echo "-------------------------------------" >> taskX.log

<Ctrl D>
Job tfm.1241710500.a will be run at Thu May  7 23:35:00 TAIST 2009.
tfmd> at -t 05072340
rsh TIA1 -l tfm "/u1/tfm/comm/shell/backupcall.sh X"
echo `date +%m%e%H%M` $status " TIA1 backupcall.sh X" >> taskX.log
rsh TIA1 -l tfm "tail -n 10 /u1/tfm/Logfile/Demand.log" >> taskX.log

<Ctrl D>

Job tfm.1241710800.a will be run at Thu May  7 23:40:00 TAIST 2009.

這個大同小異,只是指令內容變成備份的指令,這樣我就再也不會忘記做緊急配信了。因為寫完,ㄜ,基本上機器就會去做。

沒有留言: