In my script I have the below line:
proc = subprocess.Popen(["qstat", "-xml", "-u", "*", "-r", "-s", "r"], stdout=subprocess.PIPE)
It works fine when I run it, but when it is set up as a cronjob I am getting back:
Traceback (most recent call last): File
File "/seq/software/current/bin/createOpsDashboard.py", line 171,
in get_pod_occupied_slots
proc = subprocess.Popen(["qstat", "-xml", "-u", "*", "-r", "-s", "r"], stdout=subprocess.PIPE)
File "/software/free/Linux/redhat_5_x86_64/pkgs/python_2.7.1-sqlite3-rtrees/lib/python2.7/subprocess.py", line 672, in __init__ errread, errwrite)
File "/software/free/Linux/redhat_5_x86_64/pkgs/python_2.7.1-sqlite3-rtrees/lib/python2.7/subprocess.py", line 1202, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
What is causing this? The cronjob is calling a shell script which load Python-2.7 and then calls the real script.
Use full path for "qstat", eg "/usr/local/bin/qstat". PATH environment variable for cronjob is usually restricted to default path (eg /bin:/usr/bin).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.