This is a sample systemd service file generated for demonstration purposes
Generated service file ready for deployment
webapp.service
Web Application Service
/opt/webapp/start.sh
webapp
[Unit] Description=Web Application Service After=network.target [Service] Type=simple ExecStart=/opt/webapp/start.sh User=webapp Group=webapp WorkingDirectory=/opt/webapp Restart=always Environment=NODE_ENV=production Environment=PORT=3000 [Install] WantedBy=multi-user.target
sudo nano /etc/systemd/system/webapp.service
Copy and paste the generated content into this file
sudo systemctl daemon-reload
Tell systemd to reload the service files
sudo systemctl enable webapp
sudo systemctl start webapp
Enable auto-start on boot and start the service now
sudo systemctl status webapp
Verify the service is running correctly