Я использую screen после входа в систему с ssh на моем сервере. На данный момент я настраиваю расколы в окне экрана вручную и запускаю команды вручную, как показано на следующем скриншоте:
Верхняя часть должна работать tail -n 1 -f /home/server/log/access.log. Нижняя правая часть должна работать htop. Нижняя левая строка должна просто быть командной строкой
. Есть ли способ сделать это с помощью команд / сценариев, поэтому мне не нужно каждый раз переделывать ее рука?
Для конкретного случая расположения окна есть команда экрана, чтобы сохранить их в файл: layout dump. Из man screen:
layout dump [filename]
Write to a file the order of splits made in the current layout. This is
useful to recreate the order of your regions used in your current
layout. Only the current layout is recorded. While the order of the
regions are recorded, the sizes of those regions and which windows
correspond to which regions are not. If no filename is specified, the
default is layout-dump, saved in the directory that the screen process
was started in. If the file already exists, layout dump will append to
that file. As an example:
C-a : layout dump /home/user/.screenrc
will save or append the layout to the user's .screenrc file.
Итак, как только вы сделаете компоновку вручную, нажмите Ctrla :, затем введите layout dump /path/to/some/file. Макет будет сохранен в /path/to/some/file, и вы сможете восстановить его в новом сеансе с помощью:
screen -c /path/to/some/file
Для конкретного случая расположения окна есть команда экрана, чтобы сохранить их в файл: layout dump. Из man screen:
layout dump [filename]
Write to a file the order of splits made in the current layout. This is
useful to recreate the order of your regions used in your current
layout. Only the current layout is recorded. While the order of the
regions are recorded, the sizes of those regions and which windows
correspond to which regions are not. If no filename is specified, the
default is layout-dump, saved in the directory that the screen process
was started in. If the file already exists, layout dump will append to
that file. As an example:
C-a : layout dump /home/user/.screenrc
will save or append the layout to the user's .screenrc file.
Итак, как только вы сделаете компоновку вручную, нажмите Ctrla :, затем введите layout dump /path/to/some/file. Макет будет сохранен в /path/to/some/file, и вы сможете восстановить его в новом сеансе с помощью:
screen -c /path/to/some/file
Для конкретного случая расположения окна есть команда экрана, чтобы сохранить их в файл: layout dump. Из man screen:
layout dump [filename]
Write to a file the order of splits made in the current layout. This is
useful to recreate the order of your regions used in your current
layout. Only the current layout is recorded. While the order of the
regions are recorded, the sizes of those regions and which windows
correspond to which regions are not. If no filename is specified, the
default is layout-dump, saved in the directory that the screen process
was started in. If the file already exists, layout dump will append to
that file. As an example:
C-a : layout dump /home/user/.screenrc
will save or append the layout to the user's .screenrc file.
Итак, как только вы сделаете компоновку вручную, нажмите Ctrla :, затем введите layout dump /path/to/some/file. Макет будет сохранен в /path/to/some/file, и вы сможете восстановить его в новом сеансе с помощью:
screen -c /path/to/some/file
Я придумал следующее, чтобы создать вывод, указанный в моем вопросе, и после превосходного ответа @ muru. Использование layout dump дало мне следующее:
split
focus
split -v
focus
Примечание: расширение Tilde (~) не работает с layout dump, поэтому вместо ~/layout.dmp, например, вам нужно будет использовать /home/<username>/layout.dmp. Из которого я создал следующее .screenrc
# create the top screen
chdir /home/server/log
screen -t "Apache Log" tail -n 1 -f access.log
# split the screen and focus onto the new created space
split
focus
#create the bash
chdir /home/server/log
screen
# split vertically and focus onto the new area
split -v
focus
# create the htop screen
screen -t "Htop" htop
# focus twice to end up with the bash area active
focus
focus
Теперь мне нужно только ввести screen и начать мой разыскиваемый макет. Я оставляю это здесь как пример для тех, кто интересуется, но не забывайте проголосовать за ответ @ muru, так как именно он заставил меня решить это.
Я придумал следующее, чтобы создать вывод, указанный в моем вопросе, и после превосходного ответа @ muru. Использование layout dump дало мне следующее:
split
focus
split -v
focus
Примечание: расширение Tilde (~) не работает с layout dump, поэтому вместо ~/layout.dmp, например, вам нужно будет использовать /home/<username>/layout.dmp. Из которого я создал следующее .screenrc
# create the top screen
chdir /home/server/log
screen -t "Apache Log" tail -n 1 -f access.log
# split the screen and focus onto the new created space
split
focus
#create the bash
chdir /home/server/log
screen
# split vertically and focus onto the new area
split -v
focus
# create the htop screen
screen -t "Htop" htop
# focus twice to end up with the bash area active
focus
focus
Теперь мне нужно только ввести screen и начать мой разыскиваемый макет. Я оставляю это здесь как пример для тех, кто интересуется, но не забывайте проголосовать за ответ @ muru, так как именно он заставил меня решить это.
Я придумал следующее, чтобы создать вывод, указанный в моем вопросе, и после превосходного ответа @ muru. Использование layout dump дало мне следующее:
split
focus
split -v
focus
Примечание: расширение Tilde (~) не работает с layout dump, поэтому вместо ~/layout.dmp, например, вам нужно будет использовать /home/<username>/layout.dmp. Из которого я создал следующее .screenrc
# create the top screen
chdir /home/server/log
screen -t "Apache Log" tail -n 1 -f access.log
# split the screen and focus onto the new created space
split
focus
#create the bash
chdir /home/server/log
screen
# split vertically and focus onto the new area
split -v
focus
# create the htop screen
screen -t "Htop" htop
# focus twice to end up with the bash area active
focus
focus
Теперь мне нужно только ввести screen и начать мой разыскиваемый макет. Я оставляю это здесь как пример для тех, кто интересуется, но не забывайте проголосовать за ответ @ muru, так как именно он заставил меня решить это.