Remove deprecated scripts for adding head-matter to wt_config.xml, including Python and Bash implementations, to streamline configuration management.
This commit is contained in:
74
install-service.sh
Executable file
74
install-service.sh
Executable file
@@ -0,0 +1,74 @@
|
||||
#!/bin/bash
|
||||
|
||||
# SingleChat Systemd Service Installation
|
||||
# Erstellt einen systemd Service für SingleChat
|
||||
|
||||
set -e
|
||||
|
||||
SERVICE_NAME="singlechat"
|
||||
SERVICE_FILE="/etc/systemd/system/${SERVICE_NAME}.service"
|
||||
APP_DIR=$(pwd)
|
||||
USER=$(whoami)
|
||||
|
||||
echo "=========================================="
|
||||
echo "SingleChat Systemd Service Installation"
|
||||
echo "=========================================="
|
||||
|
||||
# Prüfe ob als root ausgeführt
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
echo "FEHLER: Dieses Skript muss als root ausgeführt werden!"
|
||||
echo "Bitte führe aus: sudo ./install-service.sh"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Erstelle Service-Datei
|
||||
echo "Erstelle Service-Datei..."
|
||||
cat > "$SERVICE_FILE" << EOF
|
||||
[Unit]
|
||||
Description=SingleChat Node.js Application
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=$USER
|
||||
WorkingDirectory=$APP_DIR
|
||||
Environment="NODE_ENV=production"
|
||||
Environment="PORT=4000"
|
||||
EnvironmentFile=$APP_DIR/.env
|
||||
ExecStart=/usr/bin/node server/index.js
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
SyslogIdentifier=singlechat
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
echo "✓ Service-Datei erstellt: $SERVICE_FILE"
|
||||
|
||||
# Lade systemd neu
|
||||
echo "Lade systemd neu..."
|
||||
systemctl daemon-reload
|
||||
|
||||
echo "✓ systemd neu geladen"
|
||||
|
||||
# Aktiviere Service
|
||||
echo "Aktiviere Service..."
|
||||
systemctl enable $SERVICE_NAME
|
||||
|
||||
echo "✓ Service aktiviert"
|
||||
|
||||
echo ""
|
||||
echo "=========================================="
|
||||
echo "Service-Installation abgeschlossen!"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
echo "Verfügbare Befehle:"
|
||||
echo " Start: sudo systemctl start $SERVICE_NAME"
|
||||
echo " Stop: sudo systemctl stop $SERVICE_NAME"
|
||||
echo " Status: sudo systemctl status $SERVICE_NAME"
|
||||
echo " Logs: sudo journalctl -u $SERVICE_NAME -f"
|
||||
echo ""
|
||||
|
||||
Reference in New Issue
Block a user