mirror of
https://github.com/actions/runner-images.git
synced 2026-01-03 16:49:11 +08:00
[Ubuntu] Implement new directories hierarchy (#8627)
This commit is contained in:
committed by
GitHub
parent
d1f2c9a3be
commit
5d40b1e213
34
images/ubuntu/scripts/build/cleanup.sh
Normal file
34
images/ubuntu/scripts/build/cleanup.sh
Normal file
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
# before cleanup
|
||||
before=$(df / -Pm | awk 'NR==2{print $4}')
|
||||
|
||||
# clears out the local repository of retrieved package files
|
||||
# It removes everything but the lock file from /var/cache/apt/archives/ and /var/cache/apt/archives/partial
|
||||
apt-get clean
|
||||
rm -rf /tmp/*
|
||||
rm -rf /root/.cache
|
||||
|
||||
# journalctl
|
||||
if command -v journalctl; then
|
||||
journalctl --rotate
|
||||
journalctl --vacuum-time=1s
|
||||
fi
|
||||
|
||||
# delete all .gz and rotated file
|
||||
find /var/log -type f -regex ".*\.gz$" -delete
|
||||
find /var/log -type f -regex ".*\.[0-9]$" -delete
|
||||
|
||||
# wipe log files
|
||||
find /var/log/ -type f -exec cp /dev/null {} \;
|
||||
|
||||
# after cleanup
|
||||
after=$(df / -Pm | awk 'NR==2{print $4}')
|
||||
|
||||
# display size
|
||||
echo "Before: $before MB"
|
||||
echo "After : $after MB"
|
||||
echo "Delta : $(($after-$before)) MB"
|
||||
|
||||
# delete symlink for tests running
|
||||
rm -f /usr/local/bin/invoke_tests
|
||||
Reference in New Issue
Block a user