[BangPypers] Executing Commands using sudo

2012-11-15 Thread davidsnt
Hello Team, I have a bunch of servers where I have to login as user1 and then sudo as super user and again change to user2 and execute a bunch of commands, can you guys help with any thought how can I get this done in python. I tried doing it with expect but couldnt get it right. Steps 1. Login

Re: [BangPypers] Executing Commands using sudo

2012-11-15 Thread Vid
On Thu, Nov 15, 2012 at 6:49 AM, davidsnt wrote: > Hello Team, > > I have a bunch of servers where I have to login as user1 and then sudo as > super user and again change to user2 and execute a bunch of commands, can > you guys help with any thought how can I get this done in python. Your mail is

Re: [BangPypers] Executing Commands using sudo

2012-11-15 Thread satyaakam goswami
On Thu, Nov 15, 2012 at 5:19 PM, davidsnt wrote: > Hello Team, > > I have a bunch of servers where I have to login as user1 and then sudo as > super user and again change to user2 and execute a bunch of commands, can > you guys help with any thought how can I get this done in python. > how many

Re: [BangPypers] Executing Commands using sudo

2012-11-15 Thread Rahul R
$pip install sh (http://amoffat.github.com/sh/) pretty much does everything u asked for. http://amoffat.github.com/sh/tutorials/2-interacting_with_processes.html --Rahul On Thu, Nov 15, 2012 at 10:01 PM, Vid wrote: > On Thu, Nov 15, 2012 at 6:49 AM, davidsnt wrote: > > Hello Team, > > > > I

Re: [BangPypers] Executing Commands using sudo

2012-11-15 Thread davidsnt
>>how many does a bunch mean ? close to 7 I tried a native linux way with ssh -t user1@host "sudo su -l user2" to connect to the host directly as user2 but still it fails to execute the command Regards, Davidsanthosh L On Thu, Nov 15, 2012 at 10:10 PM, satyaakam goswami wrote: > On Thu, Nov