Spaces:
Running
Running
File size: 584 Bytes
4e9eb6a 2df0cf9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #!/bin/bash
# systemd setup script
# Example: Create a systemd service file
cat > /etc/systemd/system/my-app.service << 'EOF'
[Unit]
Description=My App Service
After=network.target
[Service]
User=$USER
WorkingDirectory=/path/to/app
ExecStart=/path/to/app/venv/bin/uvicorn app:app --host 0.0.0.0 --port 8000
Restart=always
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload || echo "Warning: Failed to reload systemd"
sudo systemctl start my-app || echo "Warning: Failed to start service"
sudo systemctl enable my-app || echo "Warning: Failed to enable service"
|