Last active
November 30, 2017 12:02
-
-
Save arehmandev/de6502251d45abe84e98dbee6d04ae9f to your computer and use it in GitHub Desktop.
Insert logrotate into all jenkins seed jobs with a nifty script
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/zsh | |
| #### Uses the-silver-surfer (ag) and zsh | |
| touch rotatelogdone.txt | |
| ag -L logRotator --nocolor | xargs ls -1 > rotatelogdone.txt | |
| ARRAY=($(cat rotatelogdone.txt)) | |
| for VAR in ${ARRAY[@]} | |
| do | |
| echo $VAR | |
| gsed -i '/Job(jobName)/a \\tlogRotator { numToKeep(20) }' $VAR | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment