INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Spawn/bin/bash

Spawn/bin/bash

(OP)
Hi all, I have written several shell scritp with tcl/tk and I run it on the machine with the user group, when I give it to another user with different machine or from another IP it gives error.

Spawn/bin/bash

But if I run it from my machine where I wrote it, it runs correctly.

The header is so definite.

#! / Usr/bin/expect -f
#

Can you tell me that I have not added or am missing so that it can run from any pc and any user?
Greetings and thank you

RE: Spawn/bin/bash

maybe expect is not installed on the other machines ?

RE: Spawn/bin/bash

(OP)
Hi, I have reviewed the code and now it can run, but I have several problems now.

CODE

[lab@stadis]$ cat TM_ping.exp
#!/usr/bin/expect -f

set timeout -1
spawn $env(SHELL)
match_max 100000
send -- "telnet XXX.XXX.XXX.XXX"
expect -exact "telnet XXX.XXX.XXX.XXX"
send -- "\r"
expect -exact "\r
username: "
send -- "lab"
expect -exact "lab"
send -- "\r"
expect -exact "\r
password: "
send -- "lab\r"
expect -exact "\r
\r
MT>"
send -- "enable\r"
expect -exact "enable\r
Password: "
send -- "Megapassword!\r"
expect -exact "\r
MT#"
set output [open "/usr/local/stadis/TM_ping.exp" "a+"]
sleep 2
send -- "ping\r"
expect -exact "ping\r
Protocol \[ip\]: "
send -- "\r"
expect -exact "\r
Target IP address: "
send -- "XXX.XXX.XXX.XXX"
expect -exact "XXX.XXX.XXX.XXX"
send -- "\r"
expect -exact "\r
Repeat count \[5\]: "
send -- "10000\r"
expect -exact "10000\r
Datagram size \[100\]: "
send -- "\r"
expect -exact "\r
Timeout in seconds \[2\]: "
send -- "\r"
expect -exact "\r
Extended commands \[n\]: "
send -- "y\r"
expect -exact "y\r
Source address or interface: "
send -- "vlan100"
expect -exact "vlan100"
send -- "\r"
expect -exact "\r
Type of service \[0\]: "
send -- "\r"
expect -exact "\r
Set DF bit in IP header? \[no\]: "
send -- "\r"
expect -exact "\r
Validate reply data? \[no\]: "
send -- "\r"
expect -exact "\r
Data pattern \[0xABCD\]: "
send -- "\r"
expect -exact "\r
Loose, Strict, Record, Timestamp, Verbose\[none\]: "
send -- "\r"
expect -exact "\r
Sweep range of sizes \[n\]: "
send -- "\r"
expect "*#"
set outcome $expect_out(buffer)
send "\r"
puts $output $outcome
incr i
close $output
send -- "\r"
expect -exact "\r
MT#"
send -- "exit\r"
expect -exact "exit\r
send -- "exit\r"
expect -exact "exit\r
send -- "\r"
send -- ""
expect eof
[lab@stadis]$ 

1.- It does not finish the files well when it is executed.
2.- I do not understand why when I throw it with the crontab it gives an error and does not execute it

What steps are not performed correctly?

Greetings and thank you

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close