Hello,
I have coded something that can be easily implemented, as file under /usr/bin/watchlog:
#!/bin/sh
# declarations
[ ! -f $HOME/.watchlogrc ] && echo "5" > $HOME/.watchlogrc
TIMING=`cat $HOME/.watchlogrc`
#echo "> $@ command line started. <"
MSG=$@
if [ "--set-time" = "$1" ] ; then
echo "$2" > $HOME/.watchlogrc
exit
fi
if [ "--help" = "$0" ] ; then
echo "--help, or --set-time 5 (corresponding to e.g. 5 seconds), or a command line to be done every e.g. 5 seconds"
echo "typical application : /usr/bin/watchlog 'date > $HOME/.log-file'"
exit
fi
while [ 1 ] ; do
bash -c " $MSG "
sleep "${TIMING}s"
done
(I am not expert in linux / coder)
This code is quite useful, since it can be used for screen directly:
#.screenrc
# status
hardstatus alwayslastline "%{= Yk} %H %{= yk}%-Lw%{= kG}%50> %n%f* %t %{-}%+Lw%< %= %{= yk} %l %{= Yk} %0c:%s %d/%m %{-}"
# add CPU idle/sustem/user/interrupt stats
backtick 100 5 5 tail -n 1 $HOME/.log
caption always '%{= kY} %200` %= %100` %='
bindkey ^[[1;5A prev
bindkey ^[[1;5B next
bindkey ^[[1;5D prev
bindkey ^[[1;5C next
bindkey ^N screen
bindkey ^[[1;2D prev
bindkey ^[[1;2C next
It is a nice add-on eventually that requires to long typing, it is already in the /usr/bin and is few kb only.
Watch is cool
All the best,
Best regards
Yellow