summaryrefslogtreecommitdiff
path: root/bin/logall
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2015-03-21 12:45:27 +0900
committerSean Whitton <spwhitton@spwhitton.name>2015-03-21 12:45:49 +0900
commitc0dab3d11d17d61ff413d256119504c7972c6b1b (patch)
treefd306050a9a8ec9b95a73a7715b478be81f3cfc8 /bin/logall
parent6b84101583eff71a52069e31b9f500724db0b605 (diff)
downloaddotfiles-c0dab3d11d17d61ff413d256119504c7972c6b1b.tar.gz
logall script
Diffstat (limited to 'bin/logall')
-rwxr-xr-xbin/logall16
1 files changed, 16 insertions, 0 deletions
diff --git a/bin/logall b/bin/logall
new file mode 100755
index 00000000..832055e0
--- /dev/null
+++ b/bin/logall
@@ -0,0 +1,16 @@
+#!/bin/sh
+. $HOME/.shenv
+
+# Prepend logall to a command and its stdout and stderr will be
+# timestamped and written to a textfile in $HOME/tmp.
+
+# On Debian, needs moreutils and expect-dev packages.
+
+if [ "$1" = "" ]; then
+ echo "logall: Need a command to run" >&2
+ exit 1
+fi
+filename=$(date +$HOME/tmp/$1_%F_%H:%M:%S.txt)
+echo "running $@ at $(date +%F\ %H:%M:%S)\n" >> $filename
+unbuffer $@ | ts 2>&1 >> $filename
+echo "" >> $filename