temp: prune gitea dumps
This commit is contained in:
1 parent
6e340b6d6a
commit
7d1b3a28ef
1 file changed
+23
@@ -0,0 +1,23 @@
|
|||||||
|
name: disk-prune
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
jobs:
|
||||||
|
prune:
|
||||||
|
runs-on: nixos
|
||||||
|
steps:
|
||||||
|
- name: prune gitea dumps, keep newest 2
|
||||||
|
run: |
|
||||||
|
set +e
|
||||||
|
/run/current-system/sw/bin/docker run --rm -v /mnt/appdata:/a ubuntu:24.04 bash -c '
|
||||||
|
cd /a/gitea/dump || exit 1
|
||||||
|
echo "== before: file count"; ls -1 | wc -l
|
||||||
|
echo "== oldest"; ls -t | tail -1
|
||||||
|
echo "== newest"; ls -t | head -1
|
||||||
|
echo "== total"; du -sh /a/gitea/dump
|
||||||
|
echo "== newest 3 sizes"; for f in $(ls -t | head -3); do du -sh "$f"; done
|
||||||
|
echo "== deleting all but newest 2"
|
||||||
|
ls -t | tail -n +3 | tr "\n" "\0" | xargs -0 -r rm -rf --
|
||||||
|
echo "== after: file count"; ls -1 | wc -l
|
||||||
|
echo "== after total"; du -sh /a/gitea/dump
|
||||||
|
echo "== df"; df -h /a
|
||||||
|
'
|
||||||
Reference in new issue
Block a user