Created
August 1, 2012 11:35
-
-
Save xazax/3226050 to your computer and use it in GitHub Desktop.
Wrapper for loggin timedate from cronscripts.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
DATEFORMAT=`date +%F\ %H:%M` | |
echo "[$DATEFORMAT] Start executing $1" | |
$@ 2>&1 | sed -e "s/\(.*\)/[$DATEFORMAT] \1/" | |
echo "[$DATEFORMAT] End executing $1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ ./cronlog.sh ./tomcat.sh
[2012-08-01 13:36] Start executing ./tomcat.sh
[2012-08-01 13:36] You need root privileges to run this script
[2012-08-01 13:36] You need root privileges to run this script
[2012-08-01 13:36] End executing ./tomcat.sh
$ ./cronlog.sh ./tomcat.sh > /tmp/tomcat.log