Last active
September 19, 2019 11:16
-
-
Save DAVIDhaker/1f47adb5e624b7b1dc8a6761a33fed09 to your computer and use it in GitHub Desktop.
Backup ASTRA (cesbo) config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Place of packups | |
path=/mnt/raid1/backup/astra | |
# Astra admin login/pass | |
auth=admin:password | |
# List of ip`s of servers | |
servers=( | |
127.0.0.1 | |
192.168.1.2 | |
) | |
# Archive name | |
archive="${path}/$(date +'%Y-%m-%d_%H-%M').zip" | |
# How many days to keep history | |
days=7 | |
for server in ${servers[*]} | |
do | |
curl -s -X POST -d '{"cmd": "load"}' "http://${auth}@${server}:8000/control/" > "${server}.conf" | |
zip -u "${archive}" "${server}.conf" > /dev/null | |
rm "${server}.conf" | |
done | |
# Remove files old than N days | |
find $path -type f -mtime $days -exec rm {} \; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment