feat: DH-HIS Web Giao Ban (Node.js & Express) complete codebase
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
# Script khởi động dịch vụ web-giao-ban
|
||||
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
|
||||
cd "$DIR"
|
||||
|
||||
if systemctl is-enabled web-giao-ban.service >/dev/null 2>&1; then
|
||||
echo "Starting web-giao-ban via systemd..."
|
||||
sudo systemctl start web-giao-ban
|
||||
sleep 1
|
||||
sudo systemctl status web-giao-ban --no-pager
|
||||
else
|
||||
PID_FILE="$DIR/.app.pid"
|
||||
if [ -f "$PID_FILE" ] && kill -0 "$(cat "$PID_FILE")" 2>/dev/null; then
|
||||
echo "web-giao-ban is already running (PID: $(cat "$PID_FILE"))"
|
||||
exit 0
|
||||
fi
|
||||
echo "Starting web-giao-ban in background..."
|
||||
nohup /usr/bin/node server.js > app.log 2> error.log &
|
||||
echo $! > "$PID_FILE"
|
||||
echo "Started with PID: $!"
|
||||
fi
|
||||
Reference in New Issue
Block a user