diff options
| author | Christian Weiske <cweiske@cweiske.de> | 2011-02-05 18:14:26 +0100 |
|---|---|---|
| committer | Christian Weiske <cweiske@cweiske.de> | 2011-02-05 18:14:26 +0100 |
| commit | fbed7b5466dbb2647a5cf35c65a4c6543689c656 (patch) | |
| tree | 6c50a9946debaf9f71b14e996db72c46bbc7cb8d | |
| parent | 2dba960b30011397cbb176a6cbf1ee9d745ee933 (diff) | |
| download | usb-wde1-tools-fbed7b5466dbb2647a5cf35c65a4c6543689c656.tar.gz usb-wde1-tools-fbed7b5466dbb2647a5cf35c65a4c6543689c656.zip | |
single line logger works nwo
| -rwxr-xr-x | munin/log-single-line.sh | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/munin/log-single-line.sh b/munin/log-single-line.sh index 50c6f43..c32fa36 100755 --- a/munin/log-single-line.sh +++ b/munin/log-single-line.sh @@ -1,9 +1,12 @@ #!/bin/sh #Logs a single line into the log file passed as script parameter +# adds timestamp to the logview openformat lines - -#split words by semicolons -IFS=";" +file="$1" +if [ "x$file" = "x" ]; then + echo Please pass a file name to log the line into + exit 1 +fi #Beispielausgabe USB-WDE1: # $1;1;;13,8;22,7;22,6;17,8;22,2;21,2;22,9;;59;35;38;49;38;40;35;;;;;;;0 @@ -13,7 +16,6 @@ IFS=";" while read -r line do - timestamp = `date +%s` - echo $line sed "s/$1;1;;/$1;1;$timestamp;/" + timestamp=`date +%s` + echo $line|sed "s/\$1;1;;/\$1;1;$timestamp;/" > "$file" done -echo "done with everything" |
