This project provides a simple Makefile-based automation for managing DigitalOcean droplets and snapshots باستخدام curl و jq.
It replicates the behavior of the original PHP script:
- 📦 Creates snapshots for droplets with a specific tag
- 🧹 Deletes old snapshots based on rules
Make sure the following tools are installed:
curljq- GNU
date(Linux environment recommended)
Install jq on Ubuntu/Debian:
sudo apt install jqEdit the Makefile and update:
TOKEN := TOKEN HERE
TAG := TAG NAME HERETOKEN: Your DigitalOcean API tokenTAG: Tag used to filter droplets
makeList droplets:
make dropletsList snapshots:
make snapshots-listDelete old snapshots:
make cleanupCreate new snapshots:
make snapshots-
Deletes snapshots if:
- They are not created on Friday, OR
- They are created on Friday but older than 7 days
- Finds all droplets with the specified tag
- Creates a snapshot for each droplet
To run daily at 2 AM:
crontab -eAdd:
0 2 * * * make -C /path/to/project-
Requires a Linux environment (GNU
date) -
macOS users may need to install
coreutilsand usegdate -
Ensure your API token has permission to:
- Read droplets
- Read snapshots
- Create snapshots
- Delete snapshots
No license — use it freely.