I'm trying to execute a shellscript from Python that takes ipaddress as a parameter,
I'm using the below command but get an error, I need to execute this shellscript as a Sudo user..
Error:-
[root@linuxhost web]# python test.py
29575
usage: sudo [-D level] -h | -K | -k | -V
usage: sudo -v [-AknS] [-D level] [-g groupname|#gid] [-p prompt] [-u user
name|#uid]
process = subprocess.Popen(['sudo','/usr/local/bin/test.sh','127.0.0.1'],stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True)
process.wait()
I tried calling the shellscript by directly calling using sudo and still it fails..
process = subprocess.Popen(['sudo /usr/local/bin/test.sh','127.0.0.1'],stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True)