OpenShift - List cronjobs using the oc get cronjob command

If you are not familiar with the oc command, refer to OpenShift - Getting Started with the oc command.

The oc get cronjobs (or oc get cj) command can be used to list the cronjobs in the currently selected project / namespace.

TIP

The -A or --all-namespaces flag can be used to list the cronjobs in every project / namespace.

The -n or --namespace flag can be used to list the cronjobs in a certain project / namespace.

oc get cronjobs

 

If there are no cronjobs, something like this should be displayed.

No resources found in foo namespace.

 

On the other hand, if there are cronjobs, something like this should be displayed.

NAMESPACE  NAME   SCHEDULE       SUSPEND   ACTIVE   LAST SCHEDULE   AGE
foo        cj001  01 06 * * 1-6  False     0        21h             77d

 

Or you can list a single job in a namespace.

oc get cronjob/cj001 --namespace foo

 

Or the -A or --all-namespaces flag can be used to list the cronjobs in all namespaces.

oc get cronjobs --all-namespaces

 

The -o yaml or -o json option can be used to display more details.

oc get job/myjob-1639634460 -o yaml --namespace foo

 

Which should display something that begins like this.

apiVersion: batch/v1beta1
kind: Cronjob
metadata:
  creationTimestamp: "2021-12-16T06:01:02Z"
  labels:
    name: cj001

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee

Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.





Please enter 4f480 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |