Skip to content

Instantly share code, notes, and snippets.

@ender503
Last active March 2, 2020 07:49
Show Gist options
  • Save ender503/f2aa96af5a20e337a97c87ab22355ddf to your computer and use it in GitHub Desktop.
Save ender503/f2aa96af5a20e337a97c87ab22355ddf to your computer and use it in GitHub Desktop.
delete cache scheduler
#!/bin/bash
# delete buildkite cache
rm -rf /var/lib/buildkite-agent/builds/
rm -rf /var/lib/buildkite-agent/.cache/*
# delete docker cache
docker system prune -f
# location:
# /etc/systemd/system/delete-caches.service
[Service]
ExecStart=/usr/local/bin/delete-caches
# location:
# /etc/systemd/system/delete-caches.timer
[Timer]
OnCalendar=*-*-* 0:00:00
Unit=delete-caches.service
[Install]
WantedBy=multi-user.target
@ender503
Copy link
Author

ender503 commented Mar 2, 2020

  1. Place these configs and scripts to the specific location

  2. Start timer

$ sudo systemctl start delete-caches.timer
  1. Watch logs
$ journalctl -u delete-caches.timer -b -f
$ journalctl -u delete-caches.service -b -f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment