run: improve log
This commit is contained in:
parent
47e5868451
commit
9dd0c2c8ba
15
run
15
run
@ -7,6 +7,8 @@ session="tic2mqtt"
|
|||||||
cmd=""
|
cmd=""
|
||||||
quiet=""
|
quiet=""
|
||||||
|
|
||||||
|
cd $rundir
|
||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start) cmd=$1;;
|
start) cmd=$1;;
|
||||||
@ -57,9 +59,18 @@ case "$cmd" in
|
|||||||
;;
|
;;
|
||||||
log)
|
log)
|
||||||
if [ -n "$is_running" ]; then
|
if [ -n "$is_running" ]; then
|
||||||
tmux capture -b $session -p -S - | head -15
|
tmp=$(mktemp)
|
||||||
|
tmux capture -b $session -p -S - >$tmp
|
||||||
|
if [ $(cat $tmp |wc -l) -gt 30 ]; then
|
||||||
|
head -10 $tmp
|
||||||
|
echo
|
||||||
echo "[...]"
|
echo "[...]"
|
||||||
tmux capture -b $session -p -E -
|
echo
|
||||||
|
tail -20 $tmp
|
||||||
|
else
|
||||||
|
cat $tmp
|
||||||
|
fi
|
||||||
|
rm -f $tmp
|
||||||
else
|
else
|
||||||
echo "no tic2mqtt running"
|
echo "no tic2mqtt running"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user