summaryrefslogtreecommitdiff
path: root/bin/logall
blob: b802e43d3ca407d2be76d5193b12d77ec271e7e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh

# 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