#!/bin/bash if test -x /usr/bin/influxd ; then backup_dir=/var/backups/influxdb db=icinga2 # Prepare. mkdir -p $backup_dir chmod 700 $backup_dir # Backup. influxd backup -portable -database $db -host localhost:8088 $backup_dir/$db # Prune. find $backup_dir/$db -type f -mtime +2 -delete fi