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
| 1) Go to pam.d directory | |
| cd /etc/pam.d | |
| 2) Copy sudo_local_template | |
| sudo cp sudo_local.template sudo_local | |
| 3) Change permissions to write to that file |
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
| def jobs = Jenkins.instance.items.findAll { it.name.startsWith("git-mirror")} | |
| for(job in jobs){ | |
| if(job.builds.isEmpty() || job.builds[0].result != "SUCCESS"){ | |
| build job:job.name, propagate: false, wait: false | |
| } | |
| } |
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
| def q = Jenkins.instance.queue | |
| q.items.each { q.cancel(it.task) } | |
| for (int i=0; i < Jenkins.instance.items.size(); i++) { | |
| if(!killStuckBuilds(Jenkins.instance.items[i])){ | |
| println("Kill failed!") | |
| } | |
| } | |
| def killStuckBuilds(job){ | |
| def result = true |
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
| def jobs = Jenkins.instance.items.findAll { it.name.startsWith("test") || it.name.startsWith("deploy") } | |
| def counter = 0 | |
| for (job in jobs) { | |
| job.disabled = true | |
| counter++ | |
| } | |
| print("Disabled ${counter} jobs") |
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
| def ret = 0 | |
| def MAX_FAILURES = 3 | |
| def projects = jenkins.model.Jenkins.instance.projects.findAll { it.name.contains("ping") || it.name.contains("post") } | |
| for (p in projects) { | |
| def projectName = p.name | |
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
| server_name_pattern = /jsl0[1-9]/ | |
| jenkins.model.Jenkins.instance.getComputers().each { computer -> | |
| if (computer.getName().find(server_name_pattern)) { | |
| println computer.getName() | |
| execList = computer.getExecutors() | |
| for( exec in execList ) { | |
| busyState = exec.isBusy() ? ' busy' : ' idle' | |
| println '--' + exec.getDisplayName() + busyState | |
| if (exec.isBusy()) { | |
| exec.stop() |
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
| import hudson.model.* | |
| def q = Jenkins.instance.queue | |
| q.items.each { q.cancel(it.task) } |
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
| def MAX_DURATION_IN_HOURS = "6" | |
| for (int i=0; i < Jenkins.instance.items.size(); i++) { | |
| if(!killStuckBuilds(3600 * Integer.parseInt(MAX_DURATION_IN_HOURS), Jenkins.instance.items[i])){ | |
| println("Kill failed!") | |
| } | |
| } | |
| def killStuckBuilds(maxSeconds, job){ | |
| def result = true | |
| def runningBuilds = getRunningBuilds(job) | |
| def jobName = job.name |
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
| def jobName = "" | |
| def jobNum = "" | |
| Jenkins.instance.getItemByFullName(jobName).getBuildByNumber(jobNum).finish(hudson.model.Result.ABORTED, new java.io.IOException("Aborting build")); |
NewerOlder

