summaryrefslogtreecommitdiff
path: root/bin/logall
blob: 084ad72a252744ffe04819e3360d09337ca6b7c6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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/$(basename $1)_%F_%H:%M:%S.txt)
echo "running $@ at $(date +%F\ %H:%M:%S)\n" >> $filename
unbuffer $@ | ts 2>&1 | tee -a $filename
echo "" >> $filename