如何設置此日誌以獲得準確的時間?我正在嘗試使用date '+%Y%m%d-%H:%M'
創建日誌文件。我的輸出發生的事情是時間戳是一樣的。如何使用unix創建更準確的日誌日期
RUN refresh proc ===> 20130817-21:05
Waiting for pid:24638 ===> 20130817-21:05
Run parallel scripts ===> 20130817-21:05
Waiting for pids: 24652 ===> 20130817-21:05
Waiting for pids: 24653 ===> 20130817-21:05
Waiting for pids: 24654 ===> 20130817-21:05
Waiting for pids: 24655 ===> 20130817-21:05
Running post process ===> 20130817-21:05
Process Complete ===> 20130817-21:05
我知道在這個過程中流逝的時間。我在創建我的日誌時做錯了什麼? 這是我的工作腳本:
# Setup job
TIMESTAMP=`date '+%Y%m%d-%H:%M'`;
MYLOG=$BASEDIR/mvhistory.log
#Run Procedures
echo "====================================================" >> $MYLOG 2>&1
echo "RUN refresh proc ===> $TIMESTAMP" >> $MYLOG 2>&1
STAGING.sql &
pid0=$!
wait $pid0
echo "Waiting for pid:$pid0 ===> $TIMESTAMP" >> $MYLOG 2>&1
echo "Run parallel scripts ===> $TIMESTAMP" >> $MYLOG 2>&1
1.sql &
pid1=$!
2.sql &
pid2=$!
3.sql &
pid3=$!
4.sql &
pid4=$!
wait $pid1 $pid2 $pid3 $pid4
echo "Waiting for pids: $pid1 ===> $TIMESTAMP" >> $MYLOG 2>&1
echo "Waiting for pids: $pid2 ===> $TIMESTAMP" >> $MYLOG 2>&1
echo "Waiting for pids: $pid3 ===> $TIMESTAMP" >> $MYLOG 2>&1
echo "Waiting for pids: $pid4 ===> $TIMESTAMP" >> $MYLOG 2>&1
echo "Running post process ===> $TIMESTAMP" >> $MYLOG 2>&1
run_CLEAN.sql
echo "Process Complete ===> $TIMESTAMP" >> $MYLOG 2>&1
exit 0
這適用於我。 – jdamae