Skip to content

Instantly share code, notes, and snippets.

@Tang8330
Last active March 8, 2024 09:04
Show Gist options
  • Save Tang8330/9859a6d4495ebd9994dff5fb79be46b6 to your computer and use it in GitHub Desktop.
Save Tang8330/9859a6d4495ebd9994dff5fb79be46b6 to your computer and use it in GitHub Desktop.
Disable All Jenkins Jobs
#!/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