ÈçºÎʵÏÖºÓÄÏ¿í´ølinuxϵÄ×Ô¶¯µÇ½½Å±¾
ºÓÄÏ¿í´ø»¹Óкܶà²ÉÓõÄÊÇDHCP+µÄµÇ½·½Ê½£¬ÓÃÍøÍ¨ÌṩµÄµÇ½³ÌÐòÊÖ¹¤µÇ½ûÓÐÎÊÌ⣬µ«ÊÇÏÖÔÚÏëдһ¸ö½Å±¾×Ô¶¯µÇ½£¬Ò»¸öÅóÓѸøµÄ½Å±¾ÈçÏÂ
#!/bin/bash
cd /racer
./ecou.sh start <<!
eth0
user
pwd
!
sleep 420
/racer/ecou.sh stop
µ«ÊÇ»áÍ£ÔÚÊäÈëÃÜÂëµÄλÖ㬵ȴýÊÖ¹¤ÊäÈëÃÜÂë¡£Èç¹ûҪʵÏÖºÃÏñÒªÓõ½expect£¬µ«ÊÇÎÒȷʵ²»¶®
Õâ¸ö£¬Ï£ÍûÄܵõ½ÅóÓÑÃǵİïæ£¬Ð»Ð» Äã°ÑÊÖ¹¤µÇ¼µÄ¹ý³ÌÏêϸÃèÊöÒ»ÏÂ, ´ó¼Ò°ïÄãдһ¸ö¿´¿´
Ò»ÏÂÊǵǽÿһ²½µÄͼƬ
[root@ts home]#./ecou.sh startAll names of your net interface installed
------------------------------------------
eth0 0
Input one name to hace access with Internet (eth0): eth0
The name of interface is: eth0
The process is checking your IP address, please hold on ...
Please Enter your LOGIN:ZZ000016398
Input a password: and your PASSWORD:
Your passwd is correct. please wait for renewing IP address ...
racere has been started successfully ¸ø¸öʾÀý, ÕÕןĸÄÊÔÊÔ:
[code]
#!/usr/bin/expect -f
# starting ...
spawn ./ecou.sh start
expect "Input one name to hace access with Internet (eth0):"
send "eth0\r"
expect "Please Enter your LOGIN:"
# username
send "ZZ000016398\r"
expect "and your PASSWORD:"
# password
send "XXXX\n"
expect "has been started successfully"
expect eof
[/code] ÒÔǰÓûªÎªµÄ¿Í»§¶Ëʱ£¬ :victory: ÓвÎÊýʹÓÃÃ÷ÎÄÃÜÂëµÄ·½Ê½:victory:
Ò³:
[1]