CN101170568B - A method for automatically generating and executing Telnet command via batch mode - Google Patents

A method for automatically generating and executing Telnet command via batch mode Download PDF

Info

Publication number
CN101170568B
CN101170568B CN2007101965401A CN200710196540A CN101170568B CN 101170568 B CN101170568 B CN 101170568B CN 2007101965401 A CN2007101965401 A CN 2007101965401A CN 200710196540 A CN200710196540 A CN 200710196540A CN 101170568 B CN101170568 B CN 101170568B
Authority
CN
China
Prior art keywords
telnet
execution
script
manner
command
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.)
Active
Application number
CN2007101965401A
Other languages
Chinese (zh)
Other versions
CN101170568A (en
Inventor
吴荣辉
潘大乾
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZTE Corp
Original Assignee
ZTE Corp
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by ZTE Corp filed Critical ZTE Corp
Priority to CN2007101965401A priority Critical patent/CN101170568B/en
Publication of CN101170568A publication Critical patent/CN101170568A/en
Application granted granted Critical
Publication of CN101170568B publication Critical patent/CN101170568B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

The invention relates to the Telnet command automatic generation and batch implementing method, which is implemented in Telnet client end. The method comprises the following steps: 1.1) Telnet command customization is completed by utilizing script; 1.2) the script is analyzed; all Telnet commands are implemented item by item; the implementation is interrupted at any time according to the error of any Telnet command. The method unifies automatic customization generation, batch implementation and result feedback as a whole and acquires intellectualization and automation. Compared with the prior art, the invention can greatly improve the working efficiency of the user, improve the accuracy of command input, reduce the workload of the user and have very high commonality at the same time.

Description

A kind of telnet command generates and the batch manner of execution automatically
Technical field
The present invention relates to the telnet client system, be specifically related to a kind of telnet command generation and batch manner of execution automatically.
Background technology
The Telnet agreement is a kind of agreement that is widely used, and when equipment such as Telnet unix/linux server, data switching exchane, router, has brought into play huge effect.Through telnet client, the user can operate remote server as the PC of operation oneself, and is simple and practical.But common telnet client can only be carried out the order that the user imports by wall scroll, and is powerless for order in batches; And order is imported by the user fully by hand, can not customize generation as required automatically.Under many circumstances, the user needs customization generation telnet command automatically, and repeats, carries out in batches; And common telnet client does not possess this function; The user can only lean on the order of manual input one rule, has strengthened user's workload so on the one hand, has reduced user's operating efficiency; Also easy error on the other hand, the user also must keep the form of various command firmly in mind simultaneously.Therefore, the user presses for and a kind ofly can significantly reduce its workload, the novel telnet client system that increases work efficiency.
Summary of the invention
The technical issues that need to address of the present invention are how to provide a kind of telnet command to generate automatically and the batch manner of execution; Can accomplish the customization of telnet command, execution in batches automatically according to customer requirements; Further also can execution result and error message be kept in the journal file, supply the user to check.
Above-mentioned technical problem of the present invention solves like this, provides a kind of telnet command to generate automatically and the batch manner of execution, on telnet client, carries out, and may further comprise the steps:
1.1) utilize script to accomplish the telnet command customization;
1.2) resolve script, order is carried out wherein all telnet commands and is interrupted carrying out according to the wrong execution result of arbitrary telnet command at any time one by one.
According to manner of execution provided by the invention, said step 1.1) specifically comprise:
1.1.1) read script template according to script name;
1.1.2) from file or program, obtain corresponding script argument automatically and generate customizing script.
According to manner of execution provided by the invention, it is the xml form that said file includes, but are not limited to.
According to manner of execution provided by the invention, said step 1.2) also comprises the execution result that reads each bar telnet command and is saved in the specified file that this specified file generally is a journal file.
According to manner of execution provided by the invention; Said read to be included in search the paging character string in the server end telnet command execution result that reads and send any key information and obtain down one page content according to finding the paging character string, this paging character string is a specific character string.
According to manner of execution provided by the invention, different server ends has different character strings to be represented error message and divides page information, and therefore, said paging character string is the branch page information of this telnet client Connection Service device definition.
According to manner of execution provided by the invention; Said step 1.2) is included in and finds out the error character string in the server end telnet command execution result that reads and judge that according to finding the character string of makeing mistakes corresponding telnet command mistake carries out; This character string of makeing mistakes is other specific character string, such as " Commandnot found ".
According to manner of execution provided by the invention, different server ends possibly define different character strings and represent error message and divide page information, and therefore, the said character string of makeing mistakes is the error message of this telnet client Connection Service device definition.
According to manner of execution provided by the invention, this manner of execution is directly called by the user.
According to manner of execution provided by the invention, this manner of execution is called by concrete application software through application programming interfaces API in the telnet client system.
According to manner of execution provided by the invention, the server that this telnet client connects is computer, data switching exchane or router.
According to manner of execution provided by the invention, said step 1.2) comprises that also the said Telnet of dismounting that foundation when being positioned at this step begins is connected with the Telnet of corresponding with service device when being positioned at this step and finishing is connected.
According to manner of execution provided by the invention, said step 1.2) also comprises when said Telnet connects and carry out retry after setting up failure, surpass and specify number of retries still to fail, directly interrupt execution.
A kind of telnet command provided by the invention generates and the batch manner of execution automatically; Integrate automatic customization generate the telnet command script, in batches carry out and result's feedback with handle; Realize intellectuality and automation, compared with prior art, can improve user's operating efficiency greatly; Improve the accuracy rate of order input, reduce user's workload; In addition, the present invention also possesses the versatility advantage, the main performance both ways:
(1) versatility of Telnet server.That is to say and can use this FTP client FTP to login any Telnet server, no matter server is the PC of an operation UNIX/LINUX operating system, still is a data switching exchane or router.
(2) versatility of use object.Using object can be common user, operates the FTP client FTP among the present invention as operation general T elnet client; Also can be application program, the api interface that provides through native system calls native system.
Description of drawings
Further the present invention is elaborated below in conjunction with accompanying drawing and specific embodiment.
Fig. 1 carries out the schematic flow sheet that the script customization generates among the present invention;
Fig. 2 is a schematic flow sheet of carrying out script among the present invention;
Fig. 3 is that schematic flow sheet of the present invention directly calls in domestic consumer;
Fig. 4 is that application program is passed through API Calls schematic flow sheet of the present invention;
Embodiment
At first, explain that the present invention two is big crucial: the customization generation of script and the execution of script, wherein:
(1) customization of script generates
The customization of script generates and mainly comprises following several steps:
Steps A, read script name
So-called script is exactly the set of many telnet commands, is used to accomplish an operation, realizes one or more functions; Be similar to the errorlevel in the unix system, but the function of script is more powerful, script is stored in client; Order in the script both can be a normal commands; Also can be errorlevel, script can be realized login process, also can realize publishing process.Article one, the corresponding concrete function of script so at first will read script name, reads corresponding script template content according to title again.
Step B, read script template
Script template is a framework of script, is the script of un-customized, and need carry out that instantiation could generate to parameter wherein can execution script.Script template can be saved in file or the database.Below pass through the general format of a simple script template content interpret script template:
$USERNAME$
$PASSWORD$
cd$PATH$
del$FILENAME$
exit
What this script template was mainly realized is the operation that in unix system, gets into a file of a catalogue deletion, the content representation parameter title between " ", and USERNAME just representes login username.The parameter title need be carried out instantiation when script customizes, import concrete value into.
Step C, import the script argument value into
Customize and generate a script, just need carry out instantiation, and this process is before carrying out script, must accomplish the parameter in the script template.The value of script argument can be deposited in the file in advance (can adopt the xml form), also can be the variate-value in the program, according to its parameter title it is passed to script template when needed.For example to top one section script template of giving an example, we can set up an xml file, deposit the script argument value:
<?xml?version=″1.0″?>
<!--Script?parameter-->
<ScriptPara>
<USERNAME>admin</USERNAME>
<PASSWORD>zhongxing</PASSWORD>
<PATH>tmp</PATH>
<FILENAME>test.dat</FILENAME>
</ScriptPara>
Through reading the xml file, just can obtain actual parameter value wherein, be " admin " such as the value of " USERNAME ", actual user name that Here it is.
(2) execution of script
The execution of script mainly comprises following several steps:
Steps A, script are resolved
Just script is resolved into the executable telnet command of wall scroll.
The execution of step B, script
At first set up and is connected, import username and password login (username and password is also as the part of script) then here, login and successfully afterwards carry out all orders in the script in proper order with the Telnet of server end.
The reading and handling of step C, execution result
Client need read the command execution results of server end after sending an order to server end, and it is handled.The execution result of order possibly comprise multiple information:
1) error message: show that command execution makes mistakes, the continuation that stops script being carried out
2) divide page information: the information that service end transmitted comprises multipage, and client need be sent any key information to server end, makes server end transmit page information down
The judgement of error message is through the specific character string in the lookup result information, such as " Commandnot found " or the like, divides the judgement and the error message of page information similar.But different server ends has different character strings to be represented error message and divides page information; And the client among the present invention is a general client, so before carrying out script, need register the error message and branch page information of corresponding with service device to client.
After client reads the execution result of script, just it is saved in the journal file, the user can check at any time.
In second step, specify the present invention in conjunction with idiographic flow:
(1) flow process of script customization generation
As shown in Figure 1, this flow process specifically comprises: read the content in the script argument file, all parameters are saved in the array; Read the script template file content then, search character string wherein, if find to be included in two character strings (word) between " $ "; Judge that then it is the parameter title; In parameter array, search its corresponding actual value according to the parameter title, with actual value alternative parameter title, just to the instantiation of parameter title.All parameter title in the circulation searching parameterized template, by instantiation, a Telnet script has also just generated up to all.Next be exactly the implementation of script.
(2) flow process of execution script
As shown in Figure 2, this flow process is just extracted the telnet command in the script sentence and is handled, and sends to the process that the Telnet server end is carried out separately, specifically comprises: at first set up a TCP with the Telnet server and be connected; Connect build up after, from script, read an order, adopt character style to send to server end, then from the execution result information of server reading order.Because possibly comprise some control informations in the object information, so need resolve, extract control information wherein to the result, then readable information is returned to FTP client FTP; If comprise the bad command form in the script, will comprise error message in the object information that server end returns so, so also need whether to comprise error message in the check result information,, then interrupt the execution of script if comprise.In addition, in object information, may comprise the branch page information, just can't show, need the information of dividing multipage to show at one page; If FTP client FTP is checked through this type of information, need to send any character, to obtain down page information to the Telnet server.
In the 3rd step, divide two kinds of concrete condition explanation the present invention to use:
(1) user directly calls
As shown in Figure 3, the user calls the present invention, mainly comprises the steps:
Step 1, new script template file and script argument file, configuration script template content, input script argument;
Step 2, input need the execution script title, and FTP client FTP can find corresponding script template information according to script name;
Step 3, execution generation script function;
Step 4, execution script;
Step 5, read object information.
(2) application software is called
As shown in Figure 4, application software is being called when of the present invention, and basically identical when its step and user call only in step 2,3,4,5, is that the API through FTP client FTP realizes calling.
At last; Should be understood that; Concerning those of ordinary skills, can be equal to change or replacement by technical conceive according to the present invention, and all this change of extra creative work or protection ranges that alternative all should belong to accompanying claims of the present invention of need not.

Claims (11)

1. a telnet command generates and the batch manner of execution automatically, it is characterized in that, on telnet client, carries out, and may further comprise the steps:
1.1) utilize script to accomplish the telnet command customization;
1.2) resolve script, order is carried out wherein all telnet commands and is interrupted carrying out according to the wrong execution result of arbitrary telnet command at any time one by one.
2. according to the said manner of execution of claim 1, it is characterized in that said step 1.1) specifically comprise:
1.1.1) read script template according to script name;
1.1.2) from file or program, obtain corresponding script argument automatically and generate customizing script.
3. according to the said manner of execution of claim 2, it is characterized in that said file is the xml form.
4. according to the said manner of execution of claim 1, it is characterized in that said step 1.2) also comprise the execution result that reads each bar telnet command and be saved in the specified file.
5. according to the said manner of execution of claim 4, it is characterized in that, said read to be included in search the paging character string in the server end telnet command execution result that reads and send any key information and obtain down one page content according to finding the paging character string.
6. according to the said manner of execution of claim 1, it is characterized in that said step 1.2) be included in and find out the error character string in the server end telnet command execution result that reads and judge that according to finding the character string of makeing mistakes corresponding telnet command mistake carries out.
7. according to the said manner of execution of claim 5, it is characterized in that said paging character string is the corresponding informance of this telnet client Connection Service device.
8. according to the said manner of execution of claim 1, it is characterized in that this manner of execution is directly called by the user or is employed software transfer through application programming interfaces in the telnet client system.
9. according to the said manner of execution of claim 1, it is characterized in that the server that this telnet client connects is computer, data switching exchane or router.
10. according to the said manner of execution of claim 1, it is characterized in that said step 1.2) comprise that also the said Telnet of dismounting that foundation when being positioned at this step begins is connected with the Telnet of corresponding with service device when being positioned at this step and finishing is connected.
11., it is characterized in that the said character string of makeing mistakes is the corresponding informance of this telnet client Connection Service device according to the said manner of execution of claim 6.
CN2007101965401A 2007-11-29 2007-11-29 A method for automatically generating and executing Telnet command via batch mode Active CN101170568B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2007101965401A CN101170568B (en) 2007-11-29 2007-11-29 A method for automatically generating and executing Telnet command via batch mode

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2007101965401A CN101170568B (en) 2007-11-29 2007-11-29 A method for automatically generating and executing Telnet command via batch mode

Publications (2)

Publication Number Publication Date
CN101170568A CN101170568A (en) 2008-04-30
CN101170568B true CN101170568B (en) 2012-01-11

Family

ID=39391029

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2007101965401A Active CN101170568B (en) 2007-11-29 2007-11-29 A method for automatically generating and executing Telnet command via batch mode

Country Status (1)

Country Link
CN (1) CN101170568B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102736926B (en) * 2011-04-14 2016-06-15 中兴通讯股份有限公司 The upgrade method of a kind of task based access control template and device, batch upgrading system
CN103220170B (en) * 2013-04-07 2017-02-15 神州数码网络(北京)有限公司 Method and device for automatically configuring and managing equipment
CN104486332A (en) * 2014-12-12 2015-04-01 深圳市讯方通信技术有限公司 SDH (Synchronous Digital Hierarchy) optical transmission system and control method thereof
CN105207814B (en) * 2015-08-31 2019-05-03 茂名市群英网络有限公司 Based on dead circuit by IP policy controlling system and method
CN105183649A (en) * 2015-09-08 2015-12-23 武汉虹信通信技术有限责任公司 Automatic telnet method and system used for automatic testing
CN106302644A (en) * 2016-07-29 2017-01-04 四川天邑康和通信股份有限公司 A kind of telnet command performs system and the method for execution
CN111046252B (en) * 2019-11-20 2021-06-15 北京字节跳动网络技术有限公司 Information processing method, device, medium, electronic equipment and system
CN112000372A (en) * 2020-08-24 2020-11-27 福建天晴在线互动科技有限公司 Method and system for executing command in Linux system

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1553320A (en) * 2003-05-30 2004-12-08 英业达股份有限公司 Producing method for testing master disc
CN1848774A (en) * 2005-04-11 2006-10-18 华为技术有限公司 System and method for long-distance calling communication assembly

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1553320A (en) * 2003-05-30 2004-12-08 英业达股份有限公司 Producing method for testing master disc
CN1848774A (en) * 2005-04-11 2006-10-18 华为技术有限公司 System and method for long-distance calling communication assembly

Also Published As

Publication number Publication date
CN101170568A (en) 2008-04-30

Similar Documents

Publication Publication Date Title
CN101170568B (en) A method for automatically generating and executing Telnet command via batch mode
CN111142903B (en) Configuration file interactive updating method and device based on file comparison
US7356816B2 (en) Method and apparatus for multiplatform migration
US6370646B1 (en) Method and apparatus for multiplatform migration
US10013338B2 (en) Techniques for automated software testing
CN103336705B (en) Automatic transcoding between script process and Workflow system and semantic self adaptation
EP0756725B1 (en) Interface device and method
CN104133772A (en) Automatic test data generation method
KR102237877B1 (en) Intelligent software auto development system with real-time collaboration support and method thereof
CN106469068B (en) Application program deployment method and system
CN101311903A (en) Method and device for reusing component of software system based on component
CN110334326A (en) A kind of method and system for identifying recipe file and being converted into XML file
CN115658529A (en) Automatic testing method for user page and related equipment
CN1329818C (en) Implement method of the man machine command based on plain text command script files
CN101556540B (en) Unified management method for a plurality of backup software and system thereof
JP2000216855A (en) Method, editor, computer, control module and storage medium for editing configuration data for communication system
US20100011018A1 (en) Custom database system and method of building the same
CN115469849A (en) Service processing system, method, electronic device and storage medium
CN111221610B (en) Page element acquisition method and device
US20080022258A1 (en) Custom database system and method of building and operating the same
CN102521133A (en) TCL (tool command language)-based white-box testing automation method and TCL-based white-box testing automation system
US8631393B2 (en) Custom database system and method of building and operating the same
WO2005089350A2 (en) Custom database system and method of building the same
KR20210040545A (en) Multilingual manual authoring apparatus based on XML and method thereof
CN113485693B (en) Interface configuration method, device, equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant