I have a script where I am ssh
ing into multiple boxes and updating the date. My issue is after successfully ssh
ing in my second command is not being executed. I am doing this correctly?
Code:
command1 = "/usr/bin/ssh %(username)s@%(hostname)s" % locals()
command2 = " /usr/bin/date -s\"%(easterndate)s\"" % locals()
p = pexpect.spawn((command1 + command2), timeout=360)
Output:
-Desktop:~/Desktop$ ./pexpect_test.py /usr/local/lib/python2.6/dist-packages/pytz/tzinfo.py:5: DeprecationWarning: the sets module is deprecated from sets import Set
command1 + command2 is: /usr/bin/ssh id@something.url.com /bin/date -s"Thu Mar 28 17:21:52 EDT 2013"
Initial pexpect command output: 1
logging into box
login successful
Setting the time...