Is there a way to start a cron job manually

0 votes

Suppose, a job is scheduled to start in 12 hours, but I want to trigger it manually once now without changing the cron schedule. Is this possible?

Sep 18, 2018 in Kubernetes by lina
• 8,220 points
10,194 views

2 answers to this question.

0 votes

If your Cron job is a Linux Shell Script with the ".sh" extension, you could do the following:
 

[root@localhost ~]# sh /etc/cron.daily/your_script.sh
answered Sep 18, 2018 by Kalgi
• 52,360 points
0 votes

You can create a simple job based on your ScheduledJob. If you already run a ScheduledJob, there are jobs in history.

kubectl get jobs

NAME               DESIRED   SUCCESSFUL   AGE
hello-1477281595   1         1            11m
hello-1553106750   1         1            12m
hello-1553237822   1         1            9m

Export one of these jobs:

kubectl get job hello-1477281595 -o yaml > my_job.yaml

Then edit the yaml a little bit, erasing some unnecessary fields and run it manually:

kubectl create -f my_job.yaml
kubectl delete -f my_job.yaml
answered Sep 18, 2018 by Nilesh
• 7,050 points

Related Questions In Kubernetes

0 votes
1 answer
0 votes
1 answer

Is there a way to make a pod to automatically come up when the host restarts?

Yes using replication controller but it may ...READ MORE

answered Jul 19, 2019 in Kubernetes by Sirajul
• 59,230 points
2,059 views
+1 vote
1 answer
+1 vote
1 answer
0 votes
3 answers

Error while joining cluster with node

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

answered Jan 17, 2019 in Others by anonymous
14,587 views
+4 votes
1 answer

Installing Web UI (Dashboard):kubernetes-dashboard on main Ubuntu 16.04.6 LTS (Xenial Xerus) server

Follow these steps: $ kubeadm reset $ kubeadm init ...READ MORE

answered Apr 12, 2019 in Kubernetes by Kalgi
• 52,360 points

reshown Apr 12, 2019 by Kalgi 6,066 views
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
• 52,360 points
2,782 views
0 votes
1 answer

Connect to existing pod, execute script, disconnect - Kubernetes cron job

As far as i know there's no ...READ MORE

answered Sep 17, 2018 in Kubernetes by Kalgi
• 52,360 points
4,499 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP