How to execute commands on remote server using expect script?
I need to copy python script file to around 100 servers using expect script.
1. Copy script to my user home first(/home/myhome) on each remote server
2. change permissions on copied file to 766.
3. sudo to appuser1 account on remote server. copy script file from my user home to /usr/bin/ folder.
above script is copying file to remote server. send commands are failing. couldn't read file "766": no such file or directory
How can I get rest of the code after first sleep 1 working? Do I need to initiate another SSH connection? Can I use ssh connection opened for scp and perform other commands?
I need to copy python script file to around 100 servers using expect script.
1. Copy script to my user home first(/home/myhome) on each remote server
2. change permissions on copied file to 766.
3. sudo to appuser1 account on remote server. copy script file from my user home to /usr/bin/ folder.
above script is copying file to remote server. send commands are failing. couldn't read file "766": no such file or directory
How can I get rest of the code after first sleep 1 working? Do I need to initiate another SSH connection? Can I use ssh connection opened for scp and perform other commands?
Note that in your script the 1st argument passed to expect is -c and I have marked the 2nd argument to expect in red. That makes the 3rd argument passed to expect be the string 766 (which appears to be interpreted as a filename by expect thereby producing the diagnostic message you quoted).
If you want to pass quoted strings to commands inside the 2nd argument to expect, you need to escape the inner quotes. Note also that some of the arguments passed to send are quoted and some are not. I would assume that they should be consistently quoted or unquoted; not a mix.
Hello,
What is its mean? Could you please help me?
Best regards,
root@nimserver:/> nimadm -j nimadmvg -c dev4 -s spot1 -l lpp_source1 -d "hdisk7" -Y
Initializing the NIM master.
Initializing NIM client dev4.
0042-006 c_rsh: (exec_nimsh_cmd) exec_cmd Error 0
poll: setup failure... (2 Replies)
Hello Every one!!
I am trying to write a shell script which will connect to a remote server and execute scripts which are at a certain path in the remote server.
Before this I am using a sudo command to change the user.
The place where I am stuck is, I am able to connect to the... (6 Replies)
Hi,
The below command is not giving me the count , Can somebody help me in re-writing this pls .
Proc_Exist=`ssh -q -o "BatchMode=yes" -o "PasswordAuthentication=no" $OAUSER@${Primary_Node} ps -ef |
grep -v grep | grep "${ICM_Proc}" |wc -l `
Also the same problem with below... (13 Replies)
I am unable to run the below script against a remote server due to syntax error (then unexpected), but i am able to run it locally. Am i executing it correctly or is there any other way to execute it.
ssh username@servernname ksh -s < scriptname
#!/bin/ksh
function record
{
((end =... (5 Replies)
Hi,
I want to execute shell script with in sftp session for remote server.
like i have a shell script test.sh that is on local server.i want to execute that script on remote server
sftp user@192.168.56.10
sftp> test.sh ---execute for remote server not for local server.
sftp... (3 Replies)
Hi,
I am new to the expect scripting.
I have this expect script as below :
spawn ssh remote_server -l id
set pass "12345"
set opt "s"
expect "Password:" {send "$pass\r" ; }
expect "*ENTER*" {send "Enter\r"; exp_continue }
expect "Please select option :" {send... (2 Replies)
Hi All,
I am using a expect script to run a shell script on remote server, the code is as follows. But the problem is that it executes only first command, and hangs it doesn't run the next commands.
spawn ssh $uid@$host
expect "password:"
send "$password\r"
expect "*\r"
send... (2 Replies)
Hello All
I need a script or set of commands which can establish a remote connection with another server and execute some scripts over there. Basically it has to establish the connection with the remote server as an user ,say 'testuser' and then execute the script 'testscript'. and return the... (5 Replies)
I want to log into a remote server transfer over a new config and then backup the existing config, replace with the new config.
I am not sure if I can do this with BASH scripting.
I have set up password less login by adding my public key to authorized_keys file, it works.
I am a little... (1 Reply)