In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces you how to send multi-screen batch shell commands, the content is very detailed, interested friends can refer to, hope to be helpful to you.
Common development process of web system:
Daily-> advance-> online
On a daily basis, there is usually only one machine for integration, and everyone's development branch will do a merge deployment on this.
There is a problem when an application is developed by a lot of people and is dependent on many applications. The success of development testing on the daily environment UI depends on the services provided by the application, but short interruptions caused by frequent releases can block the process.
In order not to block the single point integration machine, consider setting up two daily machines in the form of formal batch release to ensure that there is a machine providing services in the daily environment at all times. There is a problem with this solution. Originally, debug only needs to care about one machine to read the log, just log on, but now it has become two machines.
App- |-- > vm No.1-- > log\-- > vm No.2-> log
This problem will continue to expand, if it is a unit application, the unit will also have machines, according to the above way to multiply by 2, then it will become a total of 4, see? At this time, I have a headache. Which machine will a click tested on UI fall on?
App-|-Center-|-- > vm No.1-> log |\-- > vm No.2-> log |-Unit-|-> vm No.3-> log\-- > vm No.4-> log
Let's think of a simple way to solve this problem. Tmux, as a multi-screen tool for linux, was first seen by a buddy who uses HHKB.
Basic concepts of tmux
The following reference http://cenalulu.github.io/lin... The picture on:
Session: conversation, we can define a set of logical things to do as a session, such as this session we are going to do the daily development of an application.
Window: the window, which is the console interface we see on the screen, can have multiple tab pages as on iTerm2, and can actually be understood as tab pages.
Panel: on a large window, you can split this window in order to see multiple login machines directly.
Common shortcut keys
Ctrl+b,% Vertical cut screen (window) ctrl+b, "horizontal cut screen (window)
Toggle window
Ctrl+b + window slogan ctrl+b + n to the next window ctrl+b + p to the previous window
Toggle panel
Ctrl+b + up and down, move to the desired panel
Resize panel
Ctrl+b alt+ resize vertical panel left or right ctrl+b alt+ resize horizontal panel up or down
Below, the panle on the right is enlarged.
Turn the page
Tmux is not supported by a native GUI, so we can't use the mouse in iterm2 to scroll through the page, which is more like the pure keyboard operation in vi.
Ctrl+b, [switch to replication mode. Then use ctrl+b to go back and ctrl+f forward to turn the page.
Look at the shell screen of multi-machine and send commands to multiple panel
Ctrl+b,: setw synchronize-panes
This is the focus of the day, as mentioned earlier, what if the daily machines that need to log in are expanded to four?
Imagine that we plan to connect four machines, which can be solved by cutting window with multiple panel, and our goal is to read the log, which is exactly the same on each machine:
Cd xxx/xxx/xxx tail-f xxx.log
So is there a way to send the commands we typed synchronously to all panel (all logged in machines)?
Of course, it can be solved by setting a mode.
Ctrl+b,: setw synchronize-panes
After the setting is successful, typing in one panel will be synchronized to all panel, as shown below. I only typed test in one panel.
What if you want to release it? Enter the same command (synchronize-panes) again to undo this mode.
Some default configuration functions of tmux can be configured in the file, and the path is: ~ / .tmux.conf
Share what I'm currently using:
Set-option-g default-shell / bin/zsh setw-g mode-keys vi set-option-g default-command "reattach-to-user-namespace-l zsh" set-window-option-g mode-mouse on set- g mouse-select-pane on set- g mouse-resize-pane on set- g mouse-select-window on # Setup 'v'to begin selection as in Vim bind-key-t vi-copy v begin-selection bind-key-t vi-copy y copy-pipe "reattach-to-user- Namespace pbcopy "# Update default binding of `Enter` to also use copy-pipe unbind-t vi-copy Enter bind-key-t vi-copy Enter copy-pipe" reattach-to-user-namespace pbcopy "# bind a reload key bind R source-file ~ / .tmux.conf Display-message "Config reloaded.." On how to send multi-screen batch shell commands to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.