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,100 points
386 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
• 39,270 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
• 6,900 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 in Kubernetes by Sirajul
• 17,700 points
16 views
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
• 39,270 points
30 views
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
1,594 views
+3 votes
1 answer
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
• 39,270 points
94 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
• 39,270 points
600 views