diff --git a/script.sh b/script.sh index f2af623..439b75b 100755 --- a/script.sh +++ b/script.sh @@ -152,7 +152,15 @@ cp "$parent_path"/.gitignore "$backup_path/.gitignore" if [ $moonraker_db_backups ]; then echo -e "Backup Moonraker DB" - bash "$HOME"/moonraker/scripts/backup-database.sh -o "$backup_path"/database.backup + MOONRAKER_URL="http://localhost:7125" + data='{ "filename": "moonraker-db-klipperbackup.db" }' + if curl -X POST "$MOONRAKER_URL/server/database/backup" \ + -H "Content-Type: application/json" \ + -d "$data" >/dev/null 2>&1; then + cp "$HOME"/printer_data/backup/database/moonraker-db-klipperbackup.db "$backup_path"/moonraker-db-klipperbackup.db + else + echo -e "Database Backup Failed - Is the printer printing?" + fi fi # utilize gits native exclusion file .gitignore to add files that should not be uploaded to remote. diff --git a/utils/restore_data.sh b/utils/restore_data.sh index 4d10783..353eb22 100755 --- a/utils/restore_data.sh +++ b/utils/restore_data.sh @@ -196,8 +196,13 @@ restoreBackupFiles() { restoreMoonrakerDB() { echo -e "Restore Moonraker Database" - if [ -f "$tempfolder/database.backup" ]; then - bash "$HOME"/moonraker/scripts/restore-database.sh -i "$tempfolder"/database.backup + if [ -f "$tempfolder/moonraker-db-klipperbackup.db" ]; then + cp $tempfolder/moonraker-db-klipperbackup.db "$HOME/printer_data/backup/database/moonraker-db-klipperbackup.db" + MOONRAKER_URL="http://localhost:7125" + data='{ "filename": "moonraker-db-klipperbackup.db" }' + curl -X POST "$MOONRAKER_URL/server/database/restore" \ + -H "Content-Type: application/json" \ + -d "$data" >/dev/null 2>&1 fi }