Pages

Monday, January 10, 2011

Print formatted date in shell script

#!/bin/bash
date=`date +%Y/%m/%d_%H:%M`
if tail -1 /home/asd/testlog|grep Error
then
        echo "$date | ups there's an error! restarting smsd ...">>/home/asd/cron.log;
fi

refs:

No comments:

Post a Comment