#!/bin/sh # Back up nanobot's config, memory, workspace, conversations and schedules. # The gateway stops for a few seconds so its SQLite files are copied whole. set -eu umask 077 dest="$HOME/backups/nanobot" mkdir -p "$dest" systemctl --user stop nanobot-gateway trap 'systemctl --user start nanobot-gateway' EXIT tar -C "$HOME" --exclude=.nanobot/run --exclude=.nanobot/cache \ --exclude=.nanobot/updates --exclude=.nanobot/logs \ -czf "$dest/nanobot-$(date -u +%Y%m%d-%H%M%S).tar.gz" .nanobot ls -1t "$dest"/nanobot-*.tar.gz | tail -n +15 | xargs -r rm --