[+] 增加 traefik 清理
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 11s

This commit is contained in:
Martin 2025-03-12 09:04:53 +08:00
parent 3a2e83f03a
commit 28188cf5c0

View File

@ -1,3 +1,5 @@
# 列出磁盘空间
df -h
# 清理 apt
sudo apt-get autoremove -y
sudo apt-get autoclean -y
@ -9,11 +11,9 @@ sudo journalctl --vacuum-size=10M
# 列出清理后容器大小
docker ps -a --format "{{.ID}}\t{{.Image}}\t{{.Size}}"
docker images --format "{{.Repository}}:{{.Tag}}\t{{.Size}}"
# 列出磁盘空间
df -h
# 查看占用磁盘
# sudo du -ah / | sort -rh | head -20
# du -ah -d 1 /
if [ -d "/root/act_runner" ] && docker images | grep -q "docker.martin98.com/library/gitea/act_runner"; then
echo "清理 act_runner"
@ -33,3 +33,12 @@ if [ -d "/root/registry" ] && docker images | grep -q "registry"; then
cd /root/registry
sh restart.sh
fi
if [ -d "/root/registry" ] && docker ps --format '{{.ID}} {{.Image}}' | grep -q 'traefik'; then
echo "清理 Traefik"
container_id=$(docker ps --format '{{.ID}} {{.Image}}' | grep 'traefik' | awk '{print $1}')
docker exec -it $container_id sh -c "rm -rf /tmp/*"
fi
# 列出磁盘空间
df -h