{"action":"opened","issue":{"url":"https://api.github.com/repos/mwilliamson/spur.py/issues/34","labels_url":"https://api.github.com/repos/mwilliamson/spur.py/issues/34/labels{/name}","comments_url":"https://api.github.com/repos/mwilliamson/spur.py/issues/34/comments","events_url":"https://api.github.com/repos/mwilliamson/spur.py/issues/34/events","html_url":"https://github.com/mwilliamson/spur.py/issues/34","id":106851077,"number":34,"title":"How do execute more than one command in one session?","user":{"login":"nishantrangrej8","id":5425567,"avatar_url":"https://avatars.githubusercontent.com/u/5425567?v=3","gravatar_id":"","url":"https://api.github.com/users/nishantrangrej8","html_url":"https://github.com/nishantrangrej8","followers_url":"https://api.github.com/users/nishantrangrej8/followers","following_url":"https://api.github.com/users/nishantrangrej8/following{/other_user}","gists_url":"https://api.github.com/users/nishantrangrej8/gists{/gist_id}","starred_url":"https://api.github.com/users/nishantrangrej8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nishantrangrej8/subscriptions","organizations_url":"https://api.github.com/users/nishantrangrej8/orgs","repos_url":"https://api.github.com/users/nishantrangrej8/repos","events_url":"https://api.github.com/users/nishantrangrej8/events{/privacy}","received_events_url":"https://api.github.com/users/nishantrangrej8/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-09-16T19:58:17Z","updated_at":"2015-09-16T19:58:17Z","closed_at":null,"body":"I am trying to log on to machine. And I want to maintain the same session and execute multiple commands, one after another. Here's what I am trying to do in linux\r\ncd /tmp/\r\njava -jar <Myjar>\r\ncd /tmp/results\r\nls -lrt\r\n\r\nand from the examples you have mentioned, I am trying this:\r\nshell = spur.SshShell(hostname=\"xx.xx.xxx.xxx\",\r\n                      username=\"xxxxx\",\r\n                      password=\"xxxxx\",\r\n                      shell_type=spur.ssh.ShellTypes.minimal,\r\n                      missing_host_key=spur.ssh.MissingHostKey.accept)\r\nwith shell:\r\n    result = shell.run([\"sh\", \"-c\", \"cd /tmp/\"])\r\n    result = shell.run([\"sh\", \"-c\", \"java -jar <Path to my jar>\"])\r\n    result = shell.run([\"sh\", \"-c\", \"cd /tmp/results\"])\r\n    result = shell.run([\"sh\", \"-c\", \"ls -lrt\"])    \r\nprint result.output\r\n\r\nIt is printing to all files in my directory when i log in. It is like I am logging in to shell everytime when i do shell.run. How can i just log on shell once, maintain a session and run multiple commands and close the session? \r\n\r\n"}}