Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

Calling expect from shell script which inturn call python

$
0
0
Hi Team,

I have to execute a task from my local machine, where i keep my .expect,.sh, .bash and .python scripts .Task are coded in the script and has to be executed at remote machine.

for that i used following task
.....
SCRIPT 1:
cat shell_check.sh

read value
if [ $value -eq 1]
then
expect sshscriptABC.expect
else
expect sshscript123.expect
fi

.........
SCRIPT 2:
cat sshscriptABC.expect

spawn ssh root@10.56.A.B"bash -s" < ./real.bash
expect "passwd \n"
interact

.......
SCRIPT 3:
cat real.bash

if [ $uname -eq linux ]
then
./pythonscrip.python
else
echo "fail"

******************************

I came to know when script 1 is executed,script 2 starts executed.Inside script2 we are using ssh and running local script on remote system.

but when script 2 has to execute script3 ,the file is in local system(pythonscript.python) is not getting executed

please can anyone tell me what is going wrong.

how to rectify it???:cool::cool::cool:

Viewing all articles
Browse latest Browse all 16232

Trending Articles