shell - How can I tail a log file with the date appended to its name? -
i trying use tail -f command on file name changes daily i.e. current date appended name. tried doing :
currentdate=$(date +%y%m%d.log) tail -f $currentdate
but tails files currentdate
set time when script executed. there way tail command can automatically switch new file when date changes ? cannot use crontab here execute command every day. using flume ng exec source.
i appreciate on this.
there no way tail command can automatically switch new file different name when date changes. thus, have kill old tail , start new 1 in due time.
while tail -f `date +%y%m%d.log`& sleep $(expr `date +%s -d'day 0'` - `date +%s`) kill $! done
Comments
Post a Comment