Last active
January 31, 2022 14:42
-
-
Save nickboldt/bb366f9acd2995e18ed0f836f1cb9307 to your computer and use it in GitHub Desktop.
permanent jenkins worker node cleanup script
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 | |
# cleanup permanent nodes of temp files and other miscellaneous stuff we don't need wasting disk | |
# check usage before clean | |
sudo df -h | grep -E "Avail|/dev/mapper/| /$" | |
# 1.5G from /var/cache/dnf | |
sudo dnf clean all | |
# clean out unneeded locales, leaving en_US | |
cd /usr/share/locale && \ | |
sudo rm -fr a* b* c* d* f* g* h* i* j* k* l* m* n* o* p* q* r* s* t* u* v* w* x* y* z* es* et* el* eo* eu* en_CA en@* | |
# clean out root's container and yarn caches (this shouldn't fill up anymore since we've moved to hudson user) | |
sudo rm -fr /var/lib/containers/* /usr/local/share/.cache/yarn/* | |
# clean hudson's container and yarn caches | |
sudo rm -fr /home/hudson/.local/share/containers /home/hudson/.cache/yarn/ | |
# clean out hudson's workspaces including builds that might have failed | |
sudo rm -fr /mnt/hudson_workspace/workspace/CRW_CI/crw-* | |
# clean out /var | |
for d in /var/tmp/{yarn--,tmp,python-build,quay.io-}* /var/tmp/jest_go /var/tmp/v8-compile-cache-600 /var/crash; do | |
sudo du -sch $d 2>/dev/null | |
sudo rm -fr $d | |
done | |
# clean out /tmp | |
for d in /tmp/{yarn--,tmp,python-build,quay.io-}* /tmp/jest_go /tmp/v8-compile-cache-600; do | |
sudo du -sch $d 2>/dev/null | |
sudo rm -fr $d | |
done | |
# check usage after clean | |
sudo df -h | grep -E "Avail|/dev/mapper/| /$" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment