I'm trying to run vnc server, but in order to do it first I need to run 'module load vnc'.
If I call which module
in loaded bash shell then the command in not found is the PATH but in the same time it's available. It looks like the command is built-in.
In other words it looks like I need to execute two commands at once module load vnc;vncserver :8080 -localhost
and I'm writing script to start it from python.
I have tried different variants with subprocess.Popen like
subprocess.Popen('module load vnc;vncserver :8080 -localhost', shell=True)
I'm receiving 127 exit code or command not found.
subprocess.Popen('module load vnc;vncserver :8080 -localhost', shell=False)
showing
File <path>/subprocess.py line 621, in \__init__
errread, errwrite)
OSError: [Errno 2] No such file or directory.
if I specify with shell=True then it executes from /bin/sh
but I need it from /bin/bash
.
Specifying executable='/bin/bash'
doesn't help as well.
It loads new bash shell but it starts as string but not as process, i.e I see in ps list exactly the same command I would like to start.
Would you please advice how to do start this command from subprocess module? Is it possible to have it started with shell=False?
What do you think?
Thank you.
module load vnc
need to be run in the same shell / command asvncserver
? Why do you need/bin/bash
?/bin/sh
is almost certainly a symlink to/bin/bash
. – agf Aug 19 '11 at 14:43'bash -c "module load vnc; vncserver :8080 -localhost"'
but it's probably not really the right way to do it. – tripleee Aug 19 '11 at 14:48shell
andexecutable
arguments he's talking about do – agf Aug 19 '11 at 14:49