질문&답변
클라우드/리눅스에 관한 질문과 답변을 주고 받는 곳입니다.
리눅스 분류

cron실행시..

작성자 정보

  • 전광석 작성
  • 작성일

컨텐츠 정보

본문

[root@localhost ip_]#cat ipget
#!/usr/bin/expect
spawn telnet 10.10.10.10
expect "Password: "
send "password1 "
send "en "
expect "Password: "
send "password2 "
send "term len 0 "
send "show run | i ip rou "
send "exit "
interact
[root@localhost ip_]#

위의 것을 그냥 실행시키면 결과가 제대로 나옵니다.

[root@localhost ip_]# ./ipget
spawn telnet 10.10.10.10
Trying 10.10.10.10...
Connected to 10.10.10.10
Escape character is '^]'.


User Access Verification

Password:
RouterA>en
Password:
RouterA#term len 0
RouterA#show run | i ip rou
 ip router isis
 ip route-cache distributed
 ip router isis
 ip route-cache distributed
ip route 61.74.250.0 255.255.255.0 168.126.226.9 tag 9120
....중략...
ip route 220.76.146.0 255.
ip route 220.76.147.0 255.
RouterA#exit
Connection closed by foreign host.
[root@localhost ip_]#

그런데 cron으로 실행시킬 경우에는

09 17 * * * /daily_job/ip_/ipget > /tmp/ttt

[root@localhost /tmp]# cat ttt
spawn telnet 10.10.10.10
Trying 10.10.10.10...
Connected to 10.10.10.10.
Escape character is '^]'.


User Access Verification

Password:
RouterA>en
Password: [root@localhost /tmp]#

결과가 나오다 마네요. 이래 저래 해봐도 계속 마찬가지고.. 원인이 너무 궁금합니다.

 

관련자료

댓글 0
등록된 댓글이 없습니다.

공지사항


뉴스광장


  • 현재 회원수 :  60,037 명
  • 현재 강좌수 :  35,810 개
  • 현재 접속자 :  115 명