"no such file or directory" error while executing yaml file as a cron job

0 votes

I was trying to execute a yaml file as cron job and got the following error:

container_linux.go:247: starting container process caused "exec: \"/home/ubuntu/exam.sh\": stat /home/ubuntu/exam.sh: no such file or directory"

This is my yaml file:

job2.yaml file 
apiVersion: batch/v1beta1
 kind: CronJob metadata:
   name: ghost
    role: blog
 spec:   schedule: "*/1 * * * *"   jobTemplate:
          - name: ghost
            image: ghost:0.11-alpine
            command: ["/home/ubuntu/exam.sh"]
          restartPolicy: OnFailure
Sep 18, 2018 in Kubernetes by lina
• 8,100 points

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

When you get errors like these, you first check if the job was executed a cron job, if the file exists and is executable

you can run it from kubectl run command:

kubectl run ghost --schedule="*/1 * * * *" --restart=OnFailure --image=ghost:0.11-alpine -- /bin/sh -c "your check script content" 
answered Sep 18, 2018 by Kalgi
• 36,420 points

Related Questions In Kubernetes

0 votes
3 answers

Using multiple commands in a kubernetes yaml file

Try something like this: containers: - name: ...READ MORE

answered Apr 23 in Kubernetes by lyza
0 votes
1 answer

How to fail a (cron) job after a certain number of retries?

You're trying to set 3 asbackoffLimit of your Job. ...READ MORE

answered Sep 17, 2018 in Kubernetes by Kalgi
• 36,420 points
0 votes
1 answer

Run a cron job once in N hours

If you want your cron job to ...READ MORE

answered Sep 18, 2018 in Kubernetes by Kalgi
• 36,420 points
0 votes
1 answer
0 votes
3 answers

Error while joining cluster with node

Hi Kalgi after following above steps it ...READ MORE

answered Jan 17 in Others by anonymous
+3 votes
1 answer
+1 vote
4 answers
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.