Skip to content

Instantly share code, notes, and snippets.

@DAVIDhaker
Last active September 19, 2019 11:16
Show Gist options
  • Save DAVIDhaker/1f47adb5e624b7b1dc8a6761a33fed09 to your computer and use it in GitHub Desktop.
Save DAVIDhaker/1f47adb5e624b7b1dc8a6761a33fed09 to your computer and use it in GitHub Desktop.
Backup ASTRA (cesbo) config
#!/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