如何设置此日志以获得准确的时间?我正在尝试使用创建日志文件date '+%Y%m%d-%H:%M'
。我的输出发生的情况是时间戳是相同的。
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