CN105516256A - Batch command operation method and device of Linux host - Google Patents
Batch command operation method and device of Linux host Download PDFInfo
- Publication number
- CN105516256A CN105516256A CN201510847802.0A CN201510847802A CN105516256A CN 105516256 A CN105516256 A CN 105516256A CN 201510847802 A CN201510847802 A CN 201510847802A CN 105516256 A CN105516256 A CN 105516256A
- Authority
- CN
- China
- Prior art keywords
- destination host
- thread
- order
- order active
- active thread
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 28
- 230000000977 initiatory effect Effects 0.000 claims description 4
- 230000008859 change Effects 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 238000011017 operating method Methods 0.000 description 2
- 238000003860 storage Methods 0.000 description 2
- 230000009471 action Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 239000012141 concentrate Substances 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
- 230000014759 maintenance of location Effects 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000002360 preparation method Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/141—Setup of application sessions
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer And Data Communications (AREA)
Abstract
The embodiment of the invention discloses a batch command operation method and device of a Linux host. The method comprises: creating command operation threads with quantity equal to that of pre-stored connection information, wherein the command operation threads are all command operation threads stored in a thread pool; respectively obtaining the network connection among target hosts corresponding to the command operation threads by the command operation threads according to the connection information, respectively obtaining the conversations among the target hosts corresponding to the command operation threads by the command operation threads according to the network connection; starting the conversations, after a user inputs commands, respectively executing the commands input by the users on the target hosts by the command operation threads on the basis of the conversations; respectively obtaining the feedback information of the command executed on the target hosts by the command operation threads, and displaying the feedback information. According to the batch command operation method and device of the Linux host of the invention, batch operation to the commands input by the user is carried out on different hosts.
Description
Technical field
The embodiment of the present invention relates to network communication technology field, particularly relates to a kind of batch order operation method and device of Linux main frame.
Background technology
Identical with the system management efforts of other system, when carrying out system management to Linux main frame, a regular job is managed main frame by long-range connection exactly.In order to ensure the safe operation of main frame, be necessary for this long-range connection and safety assurance is provided.Traditional long-range connection and the instrument of management host a lot, mainly contain: Telnet, FTP etc.But the transfer of data of these traditional instruments is mostly plaintext transmission, and fail safe does not ensure.Relative to these conventional tool, the fail safe of containment (Secureshell, SSH) has great lifting.SSH agreement is a kind of agreement being provided secure connection between two hosts by encryption and Authentication mechanism.By SSH agreement, system manager can be remotely logged on main frame by encryption connection, carries out various bookkeeping to main frame, very convenient.
But this convenience is only limitted to carry out remote operation to a main frame.Once need the number of the main frame carrying out Remote management operations more than two, above-mentioned remote operation process can become very loaded down with trivial details.System manager needs, respectively by the different main frame of SSH protocol entry, each main frame to run corresponding order respectively, to complete the management to different main frame, although the order run on each main frame is identical.
Summary of the invention
For above-mentioned technical problem, embodiments provide a kind of batch order operation method and device of Linux main frame, to realize running the batch of user's input command on different main frame.
First aspect, embodiments provide a kind of batch order operation method of Linux main frame, described method comprises:
Create the order active thread equal with the link information quantity prestored, wherein, described order active thread is all the order active threads be stored in thread pool;
According to described link information, the network obtained respectively between the destination host corresponding with it by described order active thread connects;
Connect according to described network, obtain the session between described destination host respectively by described order active thread, and start described session;
After user's input command, utilize described session, on described destination host, performed the order of user's input by described order active thread respectively;
Obtain exectorial feedback information on described destination host respectively by described order active thread, and show described feedback information.
Second aspect, the embodiment of the present invention additionally provides a kind of batch command device of Linux main frame, and described device comprises:
Thread creation module, the order active thread that the link information quantity for creating and prestore is equal, wherein, described order active thread is all the order active threads be stored in thread pool;
Connect acquisition module, for according to described link information, obtain the network connection between the destination host corresponding with it respectively by described order active thread;
Session initiation module, for connecting according to described network, obtaining the session between described destination host respectively by described order active thread, and starting described session;
Batch Executive Module, after user's input command, utilizes described session, is performed the order of user's input by described order active thread on described destination host respectively;
Feedback module, for obtaining exectorial feedback information on described destination host respectively by described order active thread, and shows described feedback information.
The batch order operation method of the Linux main frame that the embodiment of the present invention provides and device, by creating the order active thread equal with the link information quantity prestored, according to described link information, the network obtained respectively between the destination host corresponding with it by described order active thread connects, connect according to described network, the session between described destination host is obtained respectively by described order active thread, and start described session, after user's input command, utilize described session, on described destination host, the order of user's input is performed respectively by described order active thread, exectorial feedback information on described destination host is obtained respectively by described order active thread, and show described feedback information, achieve and the batch of user's input command on different main frame is run.
Accompanying drawing explanation
By reading the detailed description done non-limiting example done with reference to the following drawings, other features, objects and advantages of the present invention will become more obvious:
Fig. 1 is the flow chart of the batch order operation method of the Linux main frame that first embodiment of the invention provides;
Fig. 2 is the display interface figure of control terminal before the batch order that provides of first embodiment of the invention runs;
Fig. 3 is the display interface figure of control terminal after the batch order that provides of first embodiment of the invention runs;
Fig. 4 is the structure chart of the batch order running gear of the Linux main frame that second embodiment of the invention provides.
Embodiment
Below in conjunction with drawings and Examples, the present invention is described in further detail.Be understandable that, specific embodiment described herein is only for explaining the present invention, but not limitation of the invention.It also should be noted that, for convenience of description, illustrate only part related to the present invention in accompanying drawing but not entire infrastructure.
First embodiment
Present embodiments provide a kind of technical scheme of the batch order operation method of Linux main frame.The batch order operation method of described Linux main frame is performed by the batch order running gear of Linux main frame.Further, the batch order running gear of described Linux main frame be integrated in user input batch order terminal computing equipment in.Described terminal computing equipment is preferably thin client.
See Fig. 1, the batch order operation method of described Linux main frame comprises:
S11, creates the order active thread equal with the link information quantity prestored, and wherein, described order active thread is all the order active threads be stored in thread pool.
In the present embodiment, before exectorial batch runs, prestore the link information of the main frame needing to connect with it in described terminal computing equipment this locality.Described link information comprises the IP address of destination host, user name and password.Further, described link information stores in the form of an xml-file.Utilize the link information stored in described XML file, the network that described terminal computing equipment can be set up between described destination host is connected.
Provide the example of the link information stored in described XML file below:
<hostip="192.168.113.57"username="${username}"password="${password}"></host>
See code listed above, for each main frame host, have recorded in described XML file and comprise its IP address, the complete link information of username and password.Utilize above-mentioned link information, user can set up reliable network between main frame and be connected.And described XML file can adopt the parameter value of generic configuration, when needing the parameter applying generic configuration, symbol $ is used to quote.
It should be noted that, described destination host is the main frame being preinstalled with (SuSE) Linux OS.These destination hosts can be the large server, PC, work station etc. of the complete (SuSE) Linux OS such as prepackage RedhatLinux, Ubuntu, also can be installed the various embedding assembly equipment through the built-in Linux operating system of simplifying.
Before the order of batch run user input on different main frames, need first to create an order active thread to each link information prestored in described XML file.Described order active thread all creates for a concrete link information in described XML file.That is, each order active thread with will the main frame of order that inputs of run user be corresponding thereon.Therefore, the quantity of the order active thread of establishment is equal with the quantity of the link information comprised in described XML file, also equals the quantity of the main frame needing action command thereon.
Further, the order active thread of all establishments is all the order active thread in thread pool.In other words, in the present embodiment, the management of Thread Pool Technology realization to different command active thread is used.
More specifically, described thread pool is the dynamic thread pool based on working group's model.This means, all threads in described thread pool, their status are each other equality, can't occur the situation that a part of thread needs manage other a part of thread.And the quantity of active threads is dynamic change in thread pool, some threads can be stopped according to the input command of user, also can create according to the input command of user and start a part of thread.
S12, according to described link information, the network obtained respectively between the destination host corresponding with it by described order active thread connects.
Create order active thread in described thread pool after, the network obtaining the destination host corresponding with described order active thread according to described link information respectively connects.Further, the acquisition that network connects should have corresponding order thread execution.
Concrete, it is exactly that instantiation one connects (Connection) object that acquisition is connected with the network between destination host.In the instantiating process of this connecting object, the link information of the such as host IP address needing use to read from described XML file, user name, password.
And being connected with the network between described destination host of getting is that the network based on containment (Secureshell, SSH) agreement connects.
It should be noted that the acquisition that the network corresponding to different main frames connects is realized by different order active thread executed in parallel.
S13, connects according to described network, obtains the session between described destination host respectively, and start described session by described order active thread.
After obtaining the network between destination host and being connected, described order active thread continues to connect according to the network got, and obtains the session between described destination host.Further, after the described session of acquisition, described session is started by calling openSession () method.
Concrete, obtain the session between described destination host by instantiation session (Session) object.
Equally, to from the acquisition of the described session between different main frame and to start also be that order active thread by different in described thread pool realizes.
And to this operating procedure, aforesaid operating procedure all can be seen as the preparation process done in order to the order of batch run user input on multiple Linux main frame.Through the process of aforementioned several step, user is used for the computing equipment of input command and has held and carry out mutual session object with multiple main frames of actual motion order, by above-mentioned session object, the operation that the order that oneself can input by user is parallel on described multiple main frame, and acquisition runs feedback information accordingly.
S14, after user's input command, utilizes described session, is performed the order of user's input by described order active thread on described destination host respectively.
Held and carried out mutual session object with multiple Linux main frame, user can input the order that will run.In the present embodiment, described order refers to Shell order.After user have input described order, described order active thread, by described session object, the Linux main frame of its correspondence performs described order.
Such as, user have input following command statement:
du–sh/root
Then all in described thread pool order active threads perform the mentioned order of user's input respectively on the main frame of self correspondence.
S15, obtains exectorial feedback information on described destination host respectively by described order active thread, and shows described feedback information.
On described destination host after fill order, destination host can provide feedback information.Described feedback information is generally a character string.Described order active thread can get described character string.Then, can by special information displaying thread each order active thread is obtained character string cushion in (StringBuffer) object stored in a character string, and the information displaying in the most described StringBuffer object is to user.
The terminal equipment that Fig. 2 and Fig. 3 respectively illustrates the batch order operation method performing described Linux main frame is before order runs and order postrun display interface.Can see, except the various information of display before order runs, order the feedback information 31 that postrun display interface also show and to run described order and obtain on different main frame.
The present embodiment is by creating the order active thread equal with the link information quantity prestored, according to described link information, the network obtained respectively between the destination host corresponding with it by described order active thread connects, connect according to described network, the session between described destination host is obtained respectively by described order active thread, and start described session, after user's input command, utilize described session, on described destination host, the order of user's input is performed respectively by described order active thread, exectorial feedback information on described destination host is obtained respectively by described order active thread, and show described feedback information, achieve and the batch of user's input command on different main frame is run.
Second embodiment
Present embodiments provide a kind of technical scheme of the batch order running gear of Linux main frame.See Fig. 4, in this technical scheme, the batch order running gear of described Linux main frame comprises: thread creation module 41, connection acquisition module 42, session initiation module 43, batch Executive Module 44 and feedback module 45.
Described thread creation module 41 is for the equal order active thread of the link information quantity that creates and prestore, and wherein, described order active thread is all the order active threads be stored in thread pool.
Described connection acquisition module 42, for according to described link information, obtains the network connection between the destination host corresponding with it respectively by described order active thread.
Described session initiation module 43, for connecting according to described network, obtains the session between described destination host respectively by described order active thread, and starts described session.
Described batch Executive Module 44, for after user's input command, utilizes described session, is performed the order of user's input by described order active thread on described destination host respectively.
Described feedback module 45 for obtaining exectorial feedback information on described destination host respectively by described order active thread, and shows described feedback information.
Optionally, described link information comprises: the IP address of described destination host, user name and login password, and described link information is stored in desired location XML file.
Optionally, described network connects is that network based on containment SSH agreement connects.
Optionally, described thread pool is the dynamic thread pool based on working group's model.
Optionally, described destination host is the main frame having installed (SuSE) Linux OS.
Those of ordinary skill in the art should be understood that, above-mentioned of the present invention each module or each step can realize with general calculation element, they can concentrate on single calculation element, or be distributed on network that multiple calculation element forms, alternatively, they can realize with the executable program code of computer installation, thus they storages can be performed by calculation element in the storage device, or they are made into each integrated circuit modules respectively, or the multiple module in them or step are made into single integrated circuit module to realize.Like this, the present invention is not restricted to the combination of any specific hardware and software.
Each embodiment in this specification all adopts the mode of going forward one by one to describe, and what each embodiment stressed is the difference with other embodiments, the same or analogous part between each embodiment mutually see.
The foregoing is only the preferred embodiments of the present invention, be not limited to the present invention, to those skilled in the art, the present invention can have various change and change.All do within spirit of the present invention and principle any amendment, equivalent replacement, improvement etc., all should be included within protection scope of the present invention.
Claims (10)
1. a batch order operation method for Linux main frame, is characterized in that, comprising:
Create the order active thread equal with the link information quantity prestored, wherein, described order active thread is all the order active threads be stored in thread pool;
According to described link information, the network obtained respectively between the destination host corresponding with it by described order active thread connects;
Connect according to described network, obtain the session between described destination host respectively by described order active thread, and start described session;
After user's input command, utilize described session, on described destination host, performed the order of user's input by described order active thread respectively;
Obtain exectorial feedback information on described destination host respectively by described order active thread, and show described feedback information.
2. method according to claim 1, is characterized in that, described link information comprises: the IP address of described destination host, user name and login password, and described link information is stored in desired location XML file.
3. method according to claim 1, is characterized in that, it is that network based on containment SSH agreement connects that described network connects.
4. method according to claim 1, is characterized in that, described thread pool is the dynamic thread pool based on working group's model.
5. method according to claim 1, is characterized in that, described destination host is the main frame having installed (SuSE) Linux OS.
6. a batch order running gear for Linux main frame, is characterized in that, comprising:
Thread creation module, the order active thread that the link information quantity for creating and prestore is equal, wherein, described order active thread is all the order active threads be stored in thread pool;
Connect acquisition module, for according to described link information, obtain the network connection between the destination host corresponding with it respectively by described order active thread;
Session initiation module, for connecting according to described network, obtaining the session between described destination host respectively by described order active thread, and starting described session;
Batch Executive Module, after user's input command, utilizes described session, is performed the order of user's input by described order active thread on described destination host respectively;
Feedback module, for obtaining exectorial feedback information on described destination host respectively by described order active thread, and shows described feedback information.
7. method according to claim 6, is characterized in that, described link information comprises: the IP address of described destination host, user name and login password, and described link information is stored in desired location XML file.
8. method according to claim 6, is characterized in that, it is that network based on containment SSH agreement connects that described network connects.
9. method according to claim 6, is characterized in that, described thread pool is the dynamic thread pool based on working group's model.
10. method according to claim 6, is characterized in that, described destination host is the main frame having installed (SuSE) Linux OS.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510847802.0A CN105516256A (en) | 2015-11-27 | 2015-11-27 | Batch command operation method and device of Linux host |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510847802.0A CN105516256A (en) | 2015-11-27 | 2015-11-27 | Batch command operation method and device of Linux host |
Publications (1)
Publication Number | Publication Date |
---|---|
CN105516256A true CN105516256A (en) | 2016-04-20 |
Family
ID=55723887
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510847802.0A Pending CN105516256A (en) | 2015-11-27 | 2015-11-27 | Batch command operation method and device of Linux host |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105516256A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108375964A (en) * | 2018-02-12 | 2018-08-07 | 腾讯科技(深圳)有限公司 | A kind of dialog mode device management method and device |
CN108810174A (en) * | 2018-08-08 | 2018-11-13 | 郑州云海信息技术有限公司 | A kind of long-range control method and device |
CN110677308A (en) * | 2019-11-05 | 2020-01-10 | 四川长虹电器股份有限公司 | Code automatic deployment method |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020138437A1 (en) * | 2001-01-08 | 2002-09-26 | Lewin Daniel M. | Extending an internet content delivery network into an enterprise environment by locating ICDN content servers topologically near an enterprise firewall |
CN102075358A (en) * | 2010-12-31 | 2011-05-25 | 网宿科技股份有限公司 | System and method for distributing and deploying content of large-scale server cluster |
CN102523124A (en) * | 2011-12-26 | 2012-06-27 | 北京蓝汛通信技术有限责任公司 | Method and apparatus for carrying out batch processing on lots of hosts in CDN network |
-
2015
- 2015-11-27 CN CN201510847802.0A patent/CN105516256A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020138437A1 (en) * | 2001-01-08 | 2002-09-26 | Lewin Daniel M. | Extending an internet content delivery network into an enterprise environment by locating ICDN content servers topologically near an enterprise firewall |
CN102075358A (en) * | 2010-12-31 | 2011-05-25 | 网宿科技股份有限公司 | System and method for distributing and deploying content of large-scale server cluster |
CN102523124A (en) * | 2011-12-26 | 2012-06-27 | 北京蓝汛通信技术有限责任公司 | Method and apparatus for carrying out batch processing on lots of hosts in CDN network |
Non-Patent Citations (1)
Title |
---|
TTZHANGTTT: "CheungSSH运维自动化软件 批量管理上千台服务器", 《HTTPS://BLOG.CSDN.NET/TTZHANGTTT/ARTICLE/DETAILS/49454533》 * |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108375964A (en) * | 2018-02-12 | 2018-08-07 | 腾讯科技(深圳)有限公司 | A kind of dialog mode device management method and device |
CN108810174A (en) * | 2018-08-08 | 2018-11-13 | 郑州云海信息技术有限公司 | A kind of long-range control method and device |
CN110677308A (en) * | 2019-11-05 | 2020-01-10 | 四川长虹电器股份有限公司 | Code automatic deployment method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP7421511B2 (en) | Methods and apparatus, electronic devices, readable storage media and computer programs for deploying applications | |
CN107493344B (en) | Method and system for Web access to Docker container | |
US8458780B1 (en) | Pluggable login architecture and dynamic resource recognition | |
CN102196003B (en) | A kind of long-range control method of supervisory control system and device | |
US20140280805A1 (en) | Two-Sided Declarative Configuration for Cloud Deployment | |
CN111865629B (en) | Method, apparatus and computer program product for configuring service instances | |
US20160021092A1 (en) | System and method for managing heterogeneous computing environments | |
CN102998613A (en) | Test system and method capable of realizing parallel testing of circuit board | |
CN105468430A (en) | Virtualization technology-based exploration application cloud desktop construction method | |
CN105117293A (en) | Windows system environment automatic deployment method and automatic deployment system | |
CN111625496A (en) | Method, device and equipment for deploying distributed file system in virtual machine environment | |
TW201339850A (en) | Remote desktop management system and method | |
CN112235417A (en) | Method and device for sending debugging instruction | |
CN105404530B (en) | It is a kind of to realize easy deployment and the system and method using private clound | |
CN103281331A (en) | Method for enabling windows client to login remote server desktop | |
KR20210110779A (en) | Method and apparatus for providing applet service capability, electronic device, and storage medium | |
CN110062054A (en) | Internet of things equipment long-range control method and system | |
CN105516256A (en) | Batch command operation method and device of Linux host | |
CN108845946A (en) | A kind of terminal, debugging system and terminal debugging method | |
EP3416051A1 (en) | Redirection method, apparatus, and system | |
CN105763638A (en) | Cloud terminal reverse control system | |
JP7437409B2 (en) | Setting device, communication system, setting method, and program | |
Williams et al. | Utilizing ROS 1 and the turtlebot3 in a multi-robot system | |
CN104181927B (en) | A flight control law management method and device | |
CN105005716B (en) | A kind of application program remote delivery system and long-range delivery method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20160420 |