I was inspired by @koxle's "Try to purge cache for Cloudflare when image was deleted"
Purge CDNSun when a file is deleted on the VPS (w/ inotify).
This approach doesn’t touch Chevereto at all. It reacts to actual filesystem deletes (which Chevereto performs over SFTP) and purges the matching CDN objects immediately.
Purge CDNSun when a file is deleted on the VPS (w/ inotify).
apt update
apt install -y inotify-tools jq
apt install -y inotify-tools jq
Create the purge script https://pastebin.com/DSjPQYfY
Create a systemd service to watch deletes https://pastebin.com/4BhxE6XW
Verify it exists and is executable:
ls -l /usr/local/bin/cdnsun-purge.sh
sudo systemctl daemon-reload
sudo systemctl enable --now cdnsun-purge.service
Delete a test file:
rm /srv/storage/uploads/2025/11/10/IMG_94564.jpeg
Within a second or two the service will POST to:
https://cdnsun.com/api/cdns/<<PUT_YOUR_SERVICE_ID_HERE>>/purge
with:
Check watcher logs:
journalctl -u cdnsun-purge -n 50 --no-pager -l
Confirm via:
curl -I https://<<CDN_DOMAIN>>/2025/11/10/IMG_94564.jpeg
ls -l /usr/local/bin/cdnsun-purge.sh
-rwx------ 1 root root ... /usr/local/bin/cdnsun-purge.sh
sudo systemctl daemon-reload
sudo systemctl enable --now cdnsun-purge.service
Delete a test file:
rm /srv/storage/uploads/2025/11/10/IMG_94564.jpeg
Within a second or two the service will POST to:
https://cdnsun.com/api/cdns/<<PUT_YOUR_SERVICE_ID_HERE>>/purge
with:
Code:
{"purge_paths":["/2025/11/10/IMG_94564.jpeg",
"/2025/11/10/IMG_94564.md.jpeg",
"/2025/11/10/IMG_94564.th.jpeg"]}
Check watcher logs:
journalctl -u cdnsun-purge -n 50 --no-pager -l
You should see a “Purging … via CDNSun” line for the original plus .md and .th.
Confirm via:
curl -I https://<<CDN_DOMAIN>>/2025/11/10/IMG_94564.jpeg
This approach doesn’t touch Chevereto at all. It reacts to actual filesystem deletes (which Chevereto performs over SFTP) and purges the matching CDN objects immediately.
Last edited: