-
-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathdeploy_and_sync.sh
More file actions
42 lines (31 loc) · 1013 Bytes
/
deploy_and_sync.sh
File metadata and controls
42 lines (31 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
# Deploy new LightNVR binary and trigger recording sync
set -e
echo "=== Deploying new LightNVR binary ==="
# Stop service if running
echo "Stopping lightnvr service..."
sudo systemctl stop lightnvr || true
# Install new binary
echo "Installing new binary..."
sudo cp build/bin/lightnvr /usr/local/bin/lightnvr
sudo chmod +x /usr/local/bin/lightnvr
# Start service
echo "Starting lightnvr service..."
sudo systemctl start lightnvr
# Wait for service to start
echo "Waiting for service to start..."
sleep 5
# Check service status
echo "Checking service status..."
sudo systemctl status lightnvr --no-pager || true
# Wait a bit more for web server to be ready
sleep 2
# Trigger sync via API
echo ""
echo "=== Triggering recording sync via API ==="
curl -X POST http://admin:admin@localhost:8080/api/recordings/sync 2>&1 || {
echo "Failed to call sync API, trying to check logs..."
sudo journalctl -u lightnvr --since "1 minute ago" --no-pager | tail -20
}
echo ""
echo "=== Done ==="