WorkNote
notes, clips, tips of my work
Pages
Home
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:
http://www.unix.com/shell-programming-scripting/46082-date-variable.html
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment