Created
January 15, 2025 21:26
-
-
Save murphybytes/e23e254f9641b5a91ac5f98dd7a25621 to your computer and use it in GitHub Desktop.
Unsuspend all cronjobs in a namespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
######################################################################### | |
# Usage: unsuspend-cronjobs.sh <namespace> | |
# Unsuspends cronjobs in a namespace | |
######################################################################### | |
if ! command -v kubectl &> /dev/null | |
then | |
echo "kubectl must be present in order to run this script" | |
exit 1 | |
fi | |
for job in $(kubectl get cj -n "$1" | tail -n +2 | cut -d " " -f 1) | |
do | |
kubectl patch cronjobs "$job" -n "$1" -p '{"spec" : {"suspend" : false }}' | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment