-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbackup-systemd.service.template
More file actions
executable file
·35 lines (32 loc) · 1.05 KB
/
backup-systemd.service.template
File metadata and controls
executable file
·35 lines (32 loc) · 1.05 KB
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
[Unit]
Description=Server Backup Web Application
After=network.target
Wants=network.target
[Service]
Type=simple
User=USER_PLACEHOLDER
WorkingDirectory=WORKING_DIR_PLACEHOLDER
Environment="NODE_ENV=production"
Environment="PORT=PORT_PLACEHOLDER"
# Start dev servers first (in background), then production server (foreground)
# Use bash -c with proper error handling - script always succeeds, main server runs in foreground
ExecStart=/bin/bash -c 'WORKING_DIR_PLACEHOLDER/start-dev-servers.sh || true; exec NODE_PATH_PLACEHOLDER WORKING_DIR_PLACEHOLDER/dist/server/index.js'
ExecStop=WORKING_DIR_PLACEHOLDER/stop-dev-servers.sh
# Auto-restart configuration (only on failure, not on explicit stop)
# Prevent restart loops (max 5 restarts in 10 minutes)
StartLimitInterval=600
StartLimitBurst=5
# Timeout settings
TimeoutStartSec=60
TimeoutStopSec=30
# Graceful shutdown
KillMode=mixed
KillSignal=SIGTERM
# Ensure service can be stopped properly
Restart=on-failure
RestartSec=10
# Logging
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target