![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/lavocat.quebec/private_html/ |
#!/bin/bash
# Auto-start and keep server running
# This script ensures the server stays running
cd /home/gositeme/domains/lavocat.quebec/public_html
# Configuration
PORT=3000
HTTPS_PORT=3443
NODE_ENV=production
LOG_FILE=server.log
PID_FILE=server.pid
# Kill any existing server process
if [ -f "$PID_FILE" ]; then
OLD_PID=$(cat "$PID_FILE")
if ps -p $OLD_PID > /dev/null 2>&1; then
echo "🛑 Stopping existing server (PID: $OLD_PID)..."
kill $OLD_PID 2>/dev/null
sleep 2
# Force kill if still running
kill -9 $OLD_PID 2>/dev/null
fi
fi
# Kill by port if PID file is missing
pkill -f "node.*server-https.js" || true
pkill -f "npm run dev" || true
pkill -f "npm run start:production" || true
sleep 1
# Start the server in background
echo "🚀 Starting lavocat.quebec server (production)..."
echo "📝 Logs: $LOG_FILE"
echo "🌐 URL: http://0.0.0.0:$PORT"
echo "🔒 HTTPS: https://lavocat.quebec:$HTTPS_PORT"
# Export environment variables
export PORT=$PORT
export HTTPS_PORT=$HTTPS_PORT
export NODE_ENV=$NODE_ENV
export HOSTNAME=0.0.0.0
# Start server in background with nohup (production)
nohup npm run start:production > "$LOG_FILE" 2>&1 &
SERVER_PID=$!
# Save PID
echo $SERVER_PID > "$PID_FILE"
echo "✅ Server started (PID: $SERVER_PID)"
echo "📊 Monitor logs: tail -f $LOG_FILE"
echo "🛑 Stop server: kill $SERVER_PID"
# Check if server started successfully
sleep 3
if ps -p $SERVER_PID > /dev/null 2>&1; then
echo "✅ Server is running"
else
echo "❌ Server failed to start. Check $LOG_FILE for errors."
exit 1
fi