📄 callback
字号:
#!/bin/sh# @(#) callback - JPRadley v1.0 920921 - makes and uses an 'xc' script to# @(#) call a remote site, have it ring us back with a login prompt.echo -n "Remote system name? "read SYSTEM # where are we calling?echo -n "Their modem number? "read NUMBER # what's the telephone number?echo -n "Login name on $SYSTEM? "read LOGIN # how shall we log in?echo -n "Password for $LOGIN? "stty -echo # but of course!read PASSWDstty echoecho -n "\nBaud remote should use? "read RSPEED # computer-modem speed on the remoteechoWhat_To_Do=/usr/tmp/$SYSTEM.$$ # script for 'xc' to useOURPORT=ttyA02 # we'll dial out on this port and the remoteOURNBR=7874639 # calls this number to ring this portCAPTURE=/pub/jpr/logs/$SYSTEM # our log file for the sessiontrap "rm $What_To_Do" 0 # clean up when we leavecat >$What_To_Do <<TeMpLaTedebug "off"tty "off"set cfile $CAPTURE set auto "off" # no capturing -- yetset cis "off" # don't react to a spurious ^Etransmit "ats0=0e1q0v1^M" # modem should not be mutewaitfor "ok"dial "$NUMBER"echo " Dialing $NUMBER to get on to $SYSTEM"while ! waitfor "connect" 70do echo " No connection; redialing" redial donetransmit "^M" # can't hurtassign PATIENCE eq 3 # loop counterwhile ! waitfor "ogin:" 6 # waiting 6 secs for the promptdo if PATIENCE eq 0 then echo "Can't get a login prompt" beep; quit fi xmitbrk decr PATIENCEdonepause 2transmit "$LOGIN^M"echo " We're logging in now"if ! waitfor "word:"then echo "Login failed, sorry!" ; beep; quitelse transmit "$PASSWD^M^M" # the second CR is to cope with a possibleendif # tset command, and accept its defaulttransmit "/1/2/3^M" # an absolute pathname that shouldn't existif waitfor "not found"then echo " OK, we're on $SYSTEM; now we'll set up a callback"else echo "Login failed, sorry!" ; beep; quitfitransmit "echo 'yes|ct -w3 -s$RSPEED $OURNBR 2>/dev/null' | at now next min^M"waitfor "job" # the 'at' command reports a job numbertransmit "exit^M" # get off the remote systempause 2 # disconnect might reset modem, so again:transmit "ats0=1e1q0v1^M" # not mute, and auto-answerwaitfor "ok"echo " It might be a couple of minutes until $SYSTEM rings us"if ! waitfor "connect" 190then echo " It ain't gonna happen; sorry!" beep; quitendiftransmit "^M"assign PATIENCE eq 3while ! waitfor "ogin:" 6do if PATIENCE eq 0; then beep; quit; fi xmitbrk; decr PATIENCEdonepause 1; transmit "$LOGIN^M"if ! waitfor "word:"; then beep; quitelse transmit "$PASSWD^M^M"fiset auto "on" # capturing starts when we hit terminal modetransmit "/1/2/3; echo Thanks, \`uname\`, for providing this connection!^M"waitfor "not found"beepTeMpLaTexc -s$What_To_Do -l$OURPORT# th-th-aaa-t's all, folks, just drop those nickels & dimes in the slot...# eof(callback)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -