autoexpect工具和scp命令
昨天从同事那里学到一个很有用的工具,linux典型安装中会自带该工具autoexpect.
假设你需要登录到一个远程服务器上,执行一些脚本,这个过程即可通过autoexpect工具进行自动记录并且变成一个脚本.
在我平常打包时需要做几件事情,从48服务器(A)传几个文件到45服务器(B)上,然后登录到45服务器(B)执行几个shell脚本,然后再从45服务器上telnet到191服务器(C)上,在191上再执行几个shell脚本,回到45之后再将几个文件传回到48.
简而言之,即从A传文件到B—>登录B—>执行几个B上的命令—>登录C—>执行几个C上的命令—>从B传文件到A上—>Over.
下面说明如何使用autoexpect使这个过程自动化:
#autoexpect -f auto ssh B
执行这个命令后,auexexpect工具会提示你输入登录密码,同时开始记录从此之后的所有操作,直到你退出A服务器,因此我从B上向A索取文件,再在B上执行所需的命令,再telnet到C上执行脚本,最后再从B上把文件发送给A,这些过程都将被记录到auto这个脚本文件中.
今后,我只需要在A上执行expect auto这个命令即可轻松的等待它自动化完成上述工作啦~:)
PS:
在A服务器上传输文件到B时可以使用scp filename username@B:/home/public/
这句话的意思是,将A服务器上当前目录下的filename文件传输到B服务器的/home/public目录下.
PS:不过autoexpect是通过明文保存服务器的登录密码的,有需要的人可以了解一下如果对密码加密.
天行健,君子当自强不息 » Blog Archive » 基于Oracle的QTP和autoexpect命令 said,
April 11, 2007 @ 6:20 pm
[…] 准备用最拿手的脚本语言TCL来实现。这几天做了一些研究,基本有点眉目了,昨天小开推荐我一篇日志,讲的也是自动化脚本的录制,不过貌似跟我的需求还不太一样。好像这篇文章讲的内容也是第一次听说,很有学习价值。转载一下。原文链接: http://rain.snowrain.org/archives/8 昨天从同事那里学到一个很有用的工具,linux典型安装中会自带该工具autoexpect. […]
Buy valium online without a prescription. said,
September 6, 2007 @ 3:11 pm
Valium without prescription….
Valium without prescription. Valium no prescription. Valium no prescription master. No prescription valium. Valium prescription online. Generic valium no prescription….
Prescription drug called soma. said,
September 27, 2007 @ 3:23 pm
Rise against soma tickets….
Soma without prescription. Aura soma products. Soma….
Buy phentermine order cheap online. said,
October 3, 2007 @ 1:56 pm
Cheap phentermine online….
Cheap phentermine. Cheap phentermine free shipping. Phentermine buy phentermine cheap phentermine. Buy cheap phentermine….
Cheap tramadol cod buy cheap cod online tramadol. said,
October 3, 2007 @ 5:09 pm
Buy cheap tramadol mg tablets only in us online….
Buy tramadol online cod. Activado agcode buy tramadol icqwebmail info. Buy tramadol. Buy tramadol with american express. Buy online cheap and fast tramadol….
Colorado ephedra lawyer. said,
October 3, 2007 @ 8:08 pm
Drug test detect ephedra….
Ephedra is it legal. Atlanta ephedra attorneys. Colorado ephedra lawyer. Ephedra….
Cheapest tramadol available online. said,
October 3, 2007 @ 11:06 pm
Buy cheap tramadol at online drug store….
Buy tramadol online save wholesale price yep. Buy tramadol online cod. Tramadol online. Buy tramadol at a cheap price online. Tramadol hci online pharmacy. Off for tramadol online free fedex low cost. Buy online cheap and fast tramadol….
Phentermine for sale on line. said,
October 4, 2007 @ 7:38 am
Modify phentermine for sale….
Phentermine all gt gt sale. Phentermine for sale on line. Phentermine on sale. Phentermine for sale….
Buy cheap phentermine mg tabs. said,
October 4, 2007 @ 8:58 am
Buy cheap phentermine online….
Buy cheap phentermine without doctor. Buy cheap phentermine online lowest prices. Buy phentermine order cheap online….
Tramadol sale. said,
October 4, 2007 @ 1:50 pm
Tramadol sale….
Tramadol sale….
Viagra and cialis order online overnight. said,
October 5, 2007 @ 3:38 pm
Order cialis without a prescription….
Order cialis add to cart. Generic cialis pay by money order. Cheap cialis online order cialis now with discount. Discount cialis pay by money order….
Soma triathlon. said,
October 5, 2007 @ 6:32 pm
Ashes of soma lyrics….
Carisoprodol soma drug test. Soma cube. Soma….
Alprazolam online without prescription. said,
October 5, 2007 @ 9:28 pm
Alprazolam online without prescription….
Alprazolam online. Your online pharmacy alprazolam anxiety. Purchase alprazolam online medical consultations. Alprazolam online no rx. Alprazolam online without prescription….
Diazepam online. said,
October 6, 2007 @ 12:29 am
Diazepam buy diazepam buy diazepam online pharmacy….
Diazepam online. Diazepam prescription pharmacy online….
Order phentermine phentermine online. said,
October 6, 2007 @ 3:26 pm
Order phentermine online….
Order phentermine online. Buy phentermine order cheap online….
Phentermine online. said,
October 6, 2007 @ 6:21 pm
Order phentermine phentermine online….
Order phentermine online. Buy phentermine online….
Generic cialis. said,
October 6, 2007 @ 9:19 pm
Generic cialis….
Buy generic cialis. Generic cialis. Buy generic cialis without prescription. Buying generic cialis. Cialis generic….
Online discount pharmacy. said,
October 7, 2007 @ 3:02 pm
Online pharmacy….
Kroger pharmacy online. Online pharmacy. Lortab online pharmacy. Online pharmacy xlpharmacy….
Cheap phentermine. said,
October 7, 2007 @ 5:59 pm
Cheap phentermine diet pill….
Cheap phentermine 37.5. Buy cheap phentermine online pharmacy online….
Cod phentermine as well as cialis cheap reviews. said,
October 7, 2007 @ 8:58 pm
Cheap phentermine free shipping….
Cheap phentermine. Buy cheap phentermine online. Cheap phentermine without prescription….
Amoxicillin trial strep pharyngitis. said,
October 8, 2007 @ 3:18 pm
Canine dosage amoxicillin….
Amoxicillin. Dosing of amoxicillin for sinus infection. Are greyhounds allergic to amoxicillin….
Buy phentermine. said,
October 8, 2007 @ 6:11 pm
Buy phentermine on line….
Buy phentermine. Buy phentermine cod. Buy phentermine online wi. Buy phentermine online. Phentermine buy. Buy phentermine on line. Buy cheap phentermine now save….
Easy way to buy hydrocodone online. said,
October 9, 2007 @ 12:50 am
Buy hydrocodone without a prescription….
Buy hydrocodone online mastercard. Buy hydrocodone online. Buy hydrocodone online without a prescription. Buy hydrocodone. Buy hydrocodone without a prescription….
Plavix. said,
October 9, 2007 @ 8:17 pm
Plavix….
Generic plavix dangers. Plavix swelling breathing difficulties. Plavix….
cheapest prescription no phentermine said,
December 14, 2007 @ 8:46 am
prescription overnight no phentermine prescription no phentermine memerships
medium psychic in said,
December 16, 2007 @ 7:48 am
medium seminar psychic totally psychic medium
Anonymous said,
February 23, 2008 @ 2:39 pm
prescription pharmacy tramadol said,
July 27, 2008 @ 9:38 am
tramadol prescription buy without prescription tramadol
gushes first lesbian said,
August 24, 2008 @ 5:31 pm
lesbians lesbian gushes sex gushes lesbian
lesbian extacy free said,
September 3, 2008 @ 2:33 pm
lesbian extacy lesbians extacy lesbian sistas
solution activ review pro said,
September 20, 2008 @ 5:33 am
activ pro ryan solution proactiv pro activ solution