⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scripts.ps

📁 物业管理和办公自动化系统
💻 PS
📖 第 1 页 / 共 5 页
字号:
0 X([7]) 72 712 T0.38 (Don Libes, \322Using expect to Automate Systems Administration T) 99 712 P0.38 (asks\323,) 417.38 712 P1 F0.38 (Pr) 449.74 712 P0.38 (oceedings of the) 461.29 712 P1.81 (Fourth USENIX Lar) 99 698 P1.81 (ge Installation Systems Administration \050LISA\051 Confer) 200.12 698 P1.81 (ence) 465.58 698 P0 F1.81 (, Colorado) 487.55 698 P(Springs, Colorado, October 17-19, 1990.) 99 684 T([8]) 72 658 T1.05 (Norman Johnson, Samuel Kotz, \322) 99 658 P1 F1.05 (Continuous Univariate Distributions) 264.43 658 P0 F1.05 (\323, V) 443.12 658 P1.05 (ol. 1, Houghton) 462.6 658 P(Mif) 99 644 T(\337in Co, New Y) 116.77 644 T(ork, NY) 188.87 644 T(, 1970.) 226.62 644 TFMENDPAGE%%EndPage: "20" 19%%Page: "19" 19612 792 0 FMBEGINPAGE72 740.81 540 756 R7 X0 KV72 36 540 47.95 RV0 10 Q0 X(expect: Scripts for Controlling Interactive Processes) 295.54 39.95 T0 12 Q(19) 528.01 39.95 T72 63 540 720 R7 XV0 X1.08 (Thanks to Scott Paisley who wrote the callback script.  John Ousterhout is responsible for T) 72 712 P1.08 (cl,) 528.34 712 P-0.02 (without which) 72 698 P2 F-0.02 (expect) 143.92 698 P0 F-0.02 ( would not have been written.  John also critiqued) 176.55 698 P2 F-0.02 (expect) 418.52 698 P0 F-0.02 ( as well as the \336rst) 451.16 698 P(paper about it.  I am indebted to him.) 72 684 T-0.22 (Several people made important observations or wrote early scripts while I was still developing the) 72 660 P2.05 (command semantics.  Thanks to Rob Densock, Ken Manheimer) 72 646 P2.05 (, Eric Newton, Scott Paisley) 394.35 646 P2.05 (,) 537 646 P0.86 (Steve Ray) 72 632 P0.86 (, Sandy Ressler) 121.05 632 P0.86 (, Harry Bochner) 196.57 632 P0.86 (, Ira Fuchs, Craig W) 275.4 632 P0.86 (arren, Barry W) 375.8 632 P0.86 (arsaw) 448.81 632 P0.86 (, Keith Eber-) 476 632 P0.26 (hardt, Jerry Friesen, and Dan Bernstein.  Thanks to Mike Gourlay) 72 618 P0.26 (, Clem Cole, Andy Holyer) 389.27 618 P0.26 (, and) 516.42 618 P-0.18 (Alan Crosswell for help in porting) 72 604 P2 F-0.18 (expect) 238.81 604 P0 F-0.18 ( to various UNIX platforms.  Thanks to Steve Simmons,) 271.45 604 P-0.11 (Joe Gorman, and Corey Satten for \336xing some of the bugs.  Finally) 72 590 P-0.11 (, thanks to K.C. Morris, Chuck) 392.32 590 P0.84 (Dinkel, Sue Mulroney) 72 576 P0.84 (, and the anonymous Computing Systems reviewers, who gave me exten-) 179.83 576 P(sive suggestions on improving this paper) 72 562 T(.) 267.57 562 T0.77 (Certain trade names and company products are mentioned in order to adequately specify proce-) 72 538 P-0.19 (dures and equipment used.  In no case does such identi\336cation imply recommendation or endorse-) 72 524 P0.79 (ment by the National Institute of Standards and T) 72 510 P0.79 (echnology) 314.69 510 P0.79 (, nor does it imply that the products) 363.88 510 P(are necessarily the best available for the purpose.) 72 496 T3 16 Q(16.  A) 108 455.33 T(vailability) 145.47 455.33 T0 12 Q-0.26 (Since the design and implementation was paid for by the U.S. government,) 72 430 P2 F-0.26 (expect) 434.43 430 P0 F-0.26 ( is in the public) 467.06 430 P0.23 (domain.  However) 72 416 P0.23 (, the author and NIST would like credit if this program, documentation or por-) 160.91 416 P1.24 (tions of them are used.) 72 402 P2 F1.24 (expect) 194.34 402 P0 F1.24 ( may be) 226.98 402 P2 F1.24 (ftp) 271.65 402 P0 F1.24 (ed anonymously as) 286.31 402 P2 F1.24 (pub/expect/expect.shar) 384.96 402 P1.24 (.Z) 501.45 402 P0 F1.24 ( from) 512.45 402 P2 F0.29 (ft) 72 388 P0.29 (p.cme.nist.gov) 79.99 388 P0 F0.29 (.  Request email delivery by mailing to) 152.16 388 P4 F0.69 (library@cme.nist.gov) 344.04 388 P0 F0.29 (.  The con-) 487.18 388 P(tents of the message should be \050no subject line\051) 72 374 T4 F(send pub/expect/expect.shar.Z) 302.18 374 T0 F(.) 510.86 374 T(As of August, 1991, over 2500 sites had retrieved) 72 350 T2 F(expect) 313.5 350 T0 F(.) 346.13 350 T3 16 Q(17.  References) 108 309.33 T0 12 Q([1]) 72 282 T-0.12 (fsck,) 99 282 P1 F-0.12 (UNIX Pr) 124.86 282 P-0.12 (ogrammer) 167.26 282 P-0.12 (\325) 217.67 282 P-0.12 (s Manual) 220.12 282 P0 F-0.12 (, Section 8, Sun Microsystems, Inc., Mountain V) 264.97 282 P-0.12 (iew) 497.93 282 P-0.12 (, CA,) 514.47 282 P(September) 99 268 T(, 1989.) 149.82 268 T([2]) 72 242 T1.04 (Don Libes, \322expect: Curing Those Uncontrollable Fits of Interaction\323,) 99 242 P1 F1.04 (Pr) 448.43 242 P1.04 (oceedings of the) 459.98 242 P(Summer 1990 USENIX Confer) 99 228 T(ence) 245.46 228 T0 F(, Anaheim, California, June 1) 267.43 228 T(1-15, 1990.) 408.56 228 T([3]) 72 202 T1.26 (John Ousterhout, \322T) 99 202 P1.26 (cl: An Embeddable Command Language\323,) 198.28 202 P1 F1.26 (Pr) 411.75 202 P1.26 (oceedings of the W) 423.3 202 P1.26 (inter) 517.34 202 P(1990 USENIX Confer) 99 188 T(ence) 203.16 188 T0 F(, W) 225.13 188 T(ashington, D.C., January 22-26, 1990.) 241.49 188 T([4]) 72 162 T2.26 (John Ousterhout, \322tcl\0503\051 \320 overview of tool command language facilities\323,) 99 162 P1 F2.26 (unpublished) 481.36 162 P(manual page) 99 148 T0 F(, University of California at Berkeley) 161.29 148 T(, January 1990.) 339.72 148 T([5]) 72 122 T0.26 (Don Libes, \322expect User Manual\323, to be published as) 99 122 P1 F0.26 (NIST IR 744-91) 360.14 122 P0 F0.26 (, National Institute of) 436.62 122 P(Standards and T) 99 108 T(echnology) 176.11 108 T(, Gaithersbur) 225.29 108 T(g, MD.) 287.69 108 T([6]) 72 82 T0.23 (Don Libes, \322Regression T) 99 82 P0.23 (esting and Conformance T) 224.11 82 P0.23 (esting Interactive Programs\323, to appear) 351.55 82 P(in) 99 68 T1 F(IEEE T) 111.33 68 T(ransactions on Softwar) 146.31 68 T(e Engineering) 257.16 68 T0 F(, New Y) 324.78 68 T(ork, NY) 363.87 68 T(.) 401.63 68 TFMENDPAGE%%EndPage: "19" 18%%Page: "18" 18612 792 0 FMBEGINPAGE72 36 504 47.95 R7 X0 KV0 12 Q0 X(18) 72 39.95 T0 10 Q(Don Libes) 108 39.95 T72 740.81 504 756 R7 XV72 63 540 720 RV3 16 Q0 X(14.  Conclusions) 108 709.33 T2 12 Q0.65 (expect) 72 684 P0 F0.65 ( provides a means of automating interactive programs.  There are a great many such pro-) 104.63 684 P0.83 (grams in the UNIX domain that lack non-interactive alternatives.) 72 670 P2 F0.83 (expect) 398.37 670 P0 F0.83 ( leverages of) 431.01 670 P0.83 (f of these) 493.72 670 P(programs with only a small amount of programming ef) 72 656 T(fort.) 335.61 656 T2 F-0.13 (expect) 72 632 P0 F-0.13 ( solves a variety of problems with programs that 1\051 don\325) 104.63 632 P-0.13 (t run non-interactively \050) 372.96 632 P2 F-0.13 (rlogin) 486.83 632 P0 F-0.13 (,) 517.48 632 P2 F-0.13 (tel-) 523.35 632 P0 (net) 72 618 P0 F0 (\051; 2\051 \322know\323 they\325re running interactively and change their behavior \050) 87.99 618 P2 F0 (csh) 423.06 618 P0 F0 (,) 439.72 618 P2 F0 (rn) 445.72 618 P0 F0 (\051; 3\051 bypass stdio) 457.71 618 P2.11 (and open) 72 604 P2 F2.11 (/dev/tty) 122.84 604 P0 F2.11 ( \050) 161.49 604 P2 F2.11 (crypt) 170.59 604 P0 F2.11 (,) 197.9 604 P2 F2.11 (passwd) 206 604 P0 F2.11 (\051; 4\051 don\325) 243.32 604 P2.11 (t provide their full functionality non-interactively) 292.62 604 P0.32 (\050) 72 590 P2 F0.32 (fsck) 75.99 590 P0 F0.32 (,) 96.65 590 P2 F0.32 (ftp) 102.96 590 P0 F0.32 (\051; or 5\051 don\325) 117.62 590 P0.32 (t provide the friendliest user interface \050) 176.65 590 P2 F0.32 (adb) 365.76 590 P0 F0.32 (,) 385.09 590 P2 F0.32 (r) 391.41 590 P0.32 (ogue) 396.52 590 P0 F0.32 (\051.  All of the \322new\323 non-) 420.51 590 P0.4 (interactive versions that result can now be usefully called from shell scripts because they can re-) 72 576 P(turn meaningful error codes and no longer require user interaction.) 72 562 T2 F0.26 (expect) 72 538 P0 F0.26 ( provides help even when you want to run programs interactively) 104.63 538 P0.26 (.  If they lack a program-) 418.88 538 P0.16 (mable interface, you can partially automate the interaction and then share control.  Of course, the) 72 524 P0.21 (ideal solution is to rewrite the application with a programmable front-end.  For new applications,) 72 510 P0.21 (there is no excuse not to use T) 72 496 P0.21 (cl.  It is small, ef) 218.22 496 P0.21 (\336cient, easy to use, and probably suf) 299.35 496 P0.21 (\336ces for 90%) 475.62 496 P0.48 (of all tools.  Building T) 72 482 P0.48 (cl into an application will always be better than an after) 186.19 482 P0.48 (-the-fact solution) 457.24 482 P0.54 (like) 72 468 P2 F0.54 (expect) 93.52 468 P0 F0.54 (.  But for tools which don\325) 126.16 468 P0.54 (t warrant the T) 256.08 468 P0.54 (cl library) 327.79 468 P0.54 (, or are too old to be rewritten,) 371.18 468 P2 F0.54 (ex-) 524.68 468 P(pect) 72 454 T0 F( is a fast solution.) 93.31 454 T2 F-0.13 (expect) 72 430 P0 F-0.13 ( is actually quite small.  On a Sun 3, the current version is 64k.  This includes the entire T) 104.63 430 P-0.13 (cl) 531.34 430 P1.02 (language.) 72 416 P2 F1.02 (expect) 126.32 416 P0 F1.02 ( has few built-in functions.  For example,) 158.96 416 P2 F1.02 (expect) 368.29 416 P0 F1.02 ( doesn\325) 400.92 416 P1.02 (t have a communica-) 436.7 416 P-0.21 (tions protocol, nor does it know about sophisticated \336le access methods.  It doesn\325) 72 402 P-0.21 (t need to.  It can) 463.78 402 P0.42 (invoke another program to do the work.  At the same time, this gives you the \337exibility of using) 72 388 P0.4 (any software you already have.  Do you need to communicate with a serial line?  Use) 72 374 P2 F0.4 (tip) 491.22 374 P0 F0.4 (,) 505.21 374 P2 F0.4 (cu) 511.61 374 P0 F0.4 (, or) 523.61 374 P2 F(kermit) 72 360 T0 F(.  W) 106.64 360 T(ith a TCP socket?  Use) 126.47 360 T2 F(telnet) 239.07 360 T0 F(.  Y) 267.71 360 T(ou make the choice.) 284.16 360 T-0.23 (This building block philosophy is very much in keeping with the UNIX tradition of hooking small) 72 336 P0.82 (programs together to build lar) 72 322 P0.82 (ger ones.  In this respect,) 218.29 322 P2 F0.82 (expect) 345.76 322 P0 F0.82 ( functions as a new kind of glue,) 378.39 322 P0.14 (much like the shell itself.  Unfortunately) 72 308 P0.14 (, shell job control was designed only with interactive use) 266.26 308 P0.74 (in mind and cannot automatically control interactive processes.) 72 294 P2 F0.74 (expect) 387.8 294 P0 F0.74 (\325) 420.44 294 P0.74 (s job control is general-) 423.77 294 P-0.17 (ized and has no such restriction.  The two forms of job control do not interfere and can be used to-) 72 280 P(gether) 72 266 T(.) 101.31 266 T-0.3 (While) 72 242 P2 F-0.3 (expect) 104.01 242 P0 F-0.3 ( only runs on UNIX, it can be useful in managing non-UNIX sites as long as they are) 136.65 242 P1.39 (networked to a UNIX host.  V) 72 228 P1.39 (ia) 224.52 228 P2 F1.39 (telnet) 237.57 228 P0 F1.39 ( or) 266.21 228 P2 F1.39 (tip) 284.98 228 P0 F1.39 (, a script can login and play its usual interactive) 298.97 228 P-0.13 (games.  My site has scripts that do exactly this on VMS and Symbolics Lisp machines.  Our VMS) 72 214 P(wizards would rather avoid UNIX entirely) 72 200 T(, but they know a timesaver when they see it.) 274.73 200 T3 16 Q(15.  Acknowledgments) 108 159.33 T0 12 Q1.24 (This work was supported by the National Institute of Standards and T) 72 134 P1.24 (echnology \050NIST\051 Auto-) 418.94 134 P1 (mated Manufacturing Research Facility \050AMRF\051.  The AMRF is funded by both NIST and the) 72 120 P(Navy Manufacturing T) 72 106 T(echnology Program.) 181.74 106 TFMENDPAGE%%EndPage: "18" 17%%Page: "17" 17612 792 0 FMBEGINPAGE72 740.81 540 756 R7 X0 KV72 36 540 47.95 RV0 10 Q0 X(expect: Scripts for Controlling Interactive Processes) 295.54 39.95 T0 12 Q(17) 528.01 39.95 T72 63 540 720 R7 XV0 X0.99 (The solution is to have the) 72 712 P2 F0.99 (expect) 207.84 712 P0 F0.99 ( script generate the passwords directly) 240.47 712 P0.99 (.  This closes the hole,) 428.14 712 P-0.29 (while at the same time forcing the use of computer) 72 698 P-0.29 (-generated passwords which are generally more) 312.65 698 P(dif) 72 684 T(\336cult to guess than human-generated passwords.) 85.11 684 T1.13 (This technique does not extend to programs such as) 72 660 P2 F1.13 (telnet) 332.95 660 P0 F1.13 (,) 361.59 660 P2 F1.13 (ftp) 368.71 660 P0 F1.13 (,) 383.37 660 P2 F1.13 (su) 390.49 660 P0 F1.13 (, etc., where a human really) 401.83 660 P0.07 (does need to provide the password.  The solution is to have the) 72 646 P2 F0.07 (expect) 377.42 646 P0 F0.07 ( script prompt for the pass-) 410.05 646 P0.63 (word interactively via) 72 632 P5 11 Q0.64 (expect_user) 182.13 632 P0 12 Q0.63 (.  In contrast to the program \050or shell script\051 prompting when) 241.31 632 P0.37 (the password is needed,) 72 618 P2 F0.37 (expect) 190.4 618 P0 F0.37 ( can prompt at the beginning of a script for all the passwords that) 223.04 618 P-0.17 (will be needed.  Even if the same password is used in several programs, the user need only enter it) 72 604 P(once since the script will remember it until it is needed.) 72 590 T0.5 (Often, it is convenient to run such scripts in the background.  Starting processes asynchronously) 72 566 P-0.21 (from the shell, however) 72 552 P-0.21 (, prevents them from reading keyboard input.  Thus) 184.8 552 P2 F-0.21 (expect) 433.04 552 P0 F-0.21 ( scripts must be) 465.68 552 P0.1 (started synchronously) 72 538 P0.1 (.  The) 176.26 538 P5 11 Q0.11 (fork) 207.21 538 P0 12 Q0.1 ( and) 225.53 538 P5 11 Q0.11 (disconnect) 249.05 538 P0 12 Q0.1 ( commands are used later to move expect into the) 301.57 538 P(background.) 72 524 T0.18 (For example, the following script reads the password, disconnects itself from the terminal, sleeps) 72 500 P(for one hour) 72 486 T(, and then goes on to execute commands that require a password.) 130.8 486 T4 F(system stty -echo) 115.2 466 T(;# disable echoing) 342 466 T(send_user "Password: ") 115.2 452.5 T(expect_user "*\134n") 115.2 439 T(send_user "\134n") 115.2 425.5 T(;# echo newline) 342 425.5 T(system stty echo) 115.2 412 T(scan $expect_match "%s" pass) 115.2 398.5 T(;# strip off terminating \134n) 342 398.5 T(if [fork]!=0 exit) 115.2 385 T(disconnect) 115.2 371.5 T(exec sleep 3600) 115.2 358 T(spawn su) 115.2 344.5 T(expect "*Password:*") 115.2 331 T(send "$pass\134r") 115.2 317.5 T(# more commands follow) 115.2 304 T

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -