Last active
August 13, 2024 11:47
-
-
Save Tang8330/9859a6d4495ebd9994dff5fb79be46b6 to your computer and use it in GitHub Desktop.
Disable All Jenkins Jobs
This file contains 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 | |
# Check to see if your jenkins home is in | |
# /var/lib/jenkins. If it isn't, then modify the script | |
# This will traverse through all your jobs, and disable them. | |
cd /var/lib/jenkins/jobs | |
for d in */ ; do | |
cd "$d" | |
sudo sed -i 's/disabled>false/disabled>true/' config.xml | |
cd ../ | |
done | |
# Restart Jenkins just to be safe. | |
sudo /etc/init.d/jenkins restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment