Files
SkyArtShop/scripts/manage-server.sh

64 lines
1.4 KiB
Bash
Raw Normal View History

2025-12-14 17:42:13 -06:00
#!/bin/bash
# SkyArtShop PM2 Management Script
ACTION=${1:-status}
case $ACTION in
start)
echo "🚀 Starting SkyArtShop with PM2..."
cd /media/pts/Website/SkyArtShop
pm2 start ecosystem.config.js
pm2 save
echo "✅ Server started and saved to PM2"
;;
stop)
echo "⏹️ Stopping SkyArtShop..."
pm2 stop skyartshop
echo "✅ Server stopped"
;;
restart)
echo "🔄 Restarting SkyArtShop..."
pm2 restart skyartshop
echo "✅ Server restarted"
;;
status)
echo "📊 SkyArtShop Status:"
pm2 list skyartshop
echo ""
pm2 show skyartshop
;;
logs)
echo "📝 Showing SkyArtShop logs (Ctrl+C to exit)..."
pm2 logs skyartshop
;;
setup)
echo "🔧 Setting up PM2 to start on boot..."
pm2 startup systemd -u pts --hp /home/pts
echo ""
echo "⚠️ Run the command above if shown, then run:"
echo " ./manage-server.sh start"
echo " pm2 save"
;;
*)
echo "SkyArtShop Server Manager"
echo "========================="
echo ""
echo "Usage: $0 {start|stop|restart|status|logs|setup}"
echo ""
echo "Commands:"
echo " start - Start the server"
echo " stop - Stop the server"
echo " restart - Restart the server"
echo " status - Show server status"
echo " logs - Show and follow logs"
echo " setup - Configure PM2 to start on boot"
;;
esac