Chirag Makhija:
apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: hello
spec:
schedule: "* * * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: hello
image: chiragmkj02/postgres:script5
imagePullPolicy: Always
command: ["/bin/sh"]
args:
- -c
- >-
python3 /tmp/fix.py
restartPolicy: Never
Trung Tran:
this part looked weird
- >-
python3 /tmp/fix.py
Chirag Makhija:
This was just a workaround
I have also tried simply executing script
Trung Tran:
command: ["/bin/sh"]
args: ["-c", "while true; do echo hello; sleep 10;done"]
can you try and see if this command can be run?
Aneek Bera:
can u try ./tmp/fix.py
Alistair Mackay:
We would need to see the dockerfile to understand what’s going on here.
Assuming that python3
is correctly installed, and the script is correctly copied to /tmp/fix.py
and you’re sure the script has no bugs, then the following would run it
command:
- python3
- /tmp/fix.py
Chirag Makhija:
yes…everthing was fine…script was getting copied to /tmp
Chirag Makhija:
I tried setting python path and it worked
Chirag Makhija:
ENV PYTHONPATH "${PYTHONPATH}:/your/custom/path"