Welcome to the Linux Foundation Forum!

How to tail a log file?

Hi @ all!

I'm new on bash scripting and there are so many traps to step into. So your help would be really appreciated. With a lot of copy&paste and a little intuition I've made two scripts. One that logs reboots and one that logs shutdowns. So far, so good.

But that means, the uptime-logfile will grow al least 2 lines every day. I would like to set 62 lines as the maximum size and tried to limit it with the tail command this way
output = tail -n 62 $uptimelog
echo output > $uptimelog
but I do not know how to syntax this properly. I'm running a Debian 12 and need your help. Am I completely on the wrong way with that? Is there a better solution?

Categories

Upcoming Training