@aiassesstech/mighty-mark 0.5.12 → 0.5.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiassesstech/mighty-mark",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.13",
|
|
4
4
|
"description": "System Health Sentinel for AI Assess Tech Fleet — autonomous monitoring, watchdog recovery, and fleet infrastructure oversight.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -13,8 +13,8 @@ FULL_BACKUP_DAY="0" # 0=Sunday, 1=Monday, ... 6=Saturday
|
|
|
13
13
|
# Where to store backup archives
|
|
14
14
|
BACKUP_DIR="/opt/fleet-backup/backups"
|
|
15
15
|
|
|
16
|
-
# How many days to keep backups (
|
|
17
|
-
RETENTION_DAYS=
|
|
16
|
+
# How many days to keep backups (2 weekly fulls + daily lights)
|
|
17
|
+
RETENTION_DAYS=14
|
|
18
18
|
|
|
19
19
|
# Log file
|
|
20
20
|
LOG_FILE="/opt/fleet-backup/logs/backup.log"
|
|
@@ -85,8 +85,14 @@ notify_telegram() {
|
|
|
85
85
|
fi
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
PUSH_WORK=""
|
|
89
|
+
|
|
88
90
|
cleanup() {
|
|
89
|
-
rm -rf "$STAGING_DIR"
|
|
91
|
+
[[ -n "$STAGING_DIR" ]] && rm -rf "$STAGING_DIR"
|
|
92
|
+
[[ -n "$PUSH_WORK" ]] && rm -rf "$PUSH_WORK"
|
|
93
|
+
if [[ -n "${GITHUB_REPO_DIR:-}" ]]; then
|
|
94
|
+
git -C "$GITHUB_REPO_DIR" worktree prune 2>/dev/null || true
|
|
95
|
+
fi
|
|
90
96
|
}
|
|
91
97
|
|
|
92
98
|
on_error() {
|
|
@@ -101,6 +107,10 @@ on_error() {
|
|
|
101
107
|
trap on_error ERR
|
|
102
108
|
trap cleanup EXIT
|
|
103
109
|
|
|
110
|
+
# Clean up stale staging dirs from previous failed runs
|
|
111
|
+
find /tmp -maxdepth 1 -name 'fleet-backup-staging-*' -mmin +120 -exec rm -rf {} \; 2>/dev/null || true
|
|
112
|
+
find /tmp -maxdepth 1 -name 'fleet-backup-push-*' -mmin +120 -exec rm -rf {} \; 2>/dev/null || true
|
|
113
|
+
|
|
104
114
|
# ─── Collect backup contents ──────────────────────────────────────
|
|
105
115
|
|
|
106
116
|
log "Starting $TIER backup for $DATE"
|
|
@@ -290,12 +300,6 @@ if [[ "${PUSH_TO_GITHUB:-false}" == "true" ]] && [[ -d "${GITHUB_REPO_DIR:-}" ]]
|
|
|
290
300
|
|
|
291
301
|
PUSH_WORK=$(mktemp -d "/tmp/fleet-backup-push-XXXXXX")
|
|
292
302
|
|
|
293
|
-
push_cleanup() {
|
|
294
|
-
rm -rf "$PUSH_WORK"
|
|
295
|
-
git -C "$GITHUB_REPO_DIR" worktree prune 2>/dev/null || true
|
|
296
|
-
}
|
|
297
|
-
trap push_cleanup EXIT
|
|
298
|
-
|
|
299
303
|
(
|
|
300
304
|
cd "$GITHUB_REPO_DIR"
|
|
301
305
|
|
|
@@ -359,5 +363,4 @@ Agent: mighty-mark (sentinel duty — fleet safety checkpoint)"
|
|
|
359
363
|
notify_telegram "🟡 *MIGHTY MARK — GitHub Push Failed*%0A%0ATier: ${TIER} | Size: ${ARCHIVE_SIZE_MB} MB%0ABackup saved locally but GitHub push failed.%0A%0ACheck logs: /opt/fleet-backup/logs/backup.log%0AServer: $(hostname)%0ATime: $(date)"
|
|
360
364
|
fi
|
|
361
365
|
|
|
362
|
-
push_cleanup
|
|
363
366
|
fi
|