I use the screen
command on several servers, where I monitor several log files. I arrange the log files to my preferences with several splits and by naming the regions. Sometimes the server gets rebooted or I have to log out from the screen session for various reasons, and it is tedious to set the this up manually every time. Is there a way to script this somehow, so that screen opens up with e.g. three split regions initially with specific names and executes a command in each region?
Screen: can I execute commands and split the window when starting screen
gnu-screen
Best Answer
use
~/.screenrc
on the server.example:
where:
split
— splits current window/region horizontallyfocus
— switch to next regionscreen -t name [command]
— set name for current window/region and runcommand