I am trying to use Spur to connect to remote server via SSH. It works well when I give 'ps' and 'aux' argument, it works fine. When I give 'ps', 'aux', '|', 'grep' and 'java' it gives me an error
spur.results.RunProcessError: return code: 1
output: b''
stderr output: b'ERROR: Garbage option.n********* simple selection ********* ********* selection by list *********n-A all processes -C by command namen-N negate selection -G by real group ID (supports names)n-a all w/ tty except session leaders -U by real user ID (supports names)n-d all except session leaders -g by session OR by effective group namen-e all processes -p by process IDnT all processes on this terminal -s processes in the sessions givenna all w/ tty, including other users -t by ttyng OBSOLETE -- DO NOT USE -u by effective user ID (supports names)nr only running processes U processes for specified usersnx processes w/o controlling ttys t by ttyn*********** output format ********** *********** long options ***********n-o,o user-defined -f full --Group --User --pid --cols --ppidn-j,j job control s signal --group --user --sid --rows --infon-O,O preloaded -o v virtual memory --cumulative --format --deselectn-l,l long u user-oriented --sort --tty --forest --versionn-F extra full X registers --heading --no-heading --contextn ********* misc options *********n-V,V show version L list format codes f ASCII art forestn-m,m,-L,-T,H threads S children in sum -y change -l formatn-M,Z security data c true command name -c scheduling classn-w,w wide output n numeric WCHAN,UID -H process hierarchyn'
My code is as following :
import spur
shell = spur.SshShell(hostname='hostname',
username='uname',
password='password')
with shell:
result = shell.run(['ps', 'aux', '| grep java'])
print result.output
Please help me if anyone has faced similar issue
Aucun commentaire:
Enregistrer un commentaire