Startup and Shutdown
Procedures for starting, stopping, and restarting the crocbot gateway across different deployment models.Quick Reference
| Action | systemd | Docker |
|---|---|---|
| Start | systemctl --user start crocbot-gateway | docker start crocbot |
| Stop | systemctl --user stop crocbot-gateway | docker stop crocbot |
| Restart | systemctl --user restart crocbot-gateway | docker restart crocbot |
| Status | systemctl --user status crocbot-gateway | docker ps -f name=crocbot |
| Logs | journalctl --user -u crocbot-gateway -f | docker logs -f crocbot |
systemd (User Service)
Service Location
The systemd user service file is typically at:Starting the Gateway
Stopping the Gateway
Restarting the Gateway
Enable on Boot
Viewing Logs
Troubleshooting systemd
Service won’t start:Docker
Starting the Container
First-Time Docker Run
Stopping the Container
Restarting the Container
Viewing Logs
Docker Compose
If using docker-compose:Troubleshooting Docker
Container won’t start:Graceful Shutdown
The gateway handles shutdown signals gracefully:- SIGTERM - Initiates graceful shutdown
- Stops accepting new connections
- Completes in-flight requests (up to 30s timeout)
- Closes Telegram connection cleanly
- Flushes logs and metrics
- Exits with code 0
Manual Graceful Shutdown
Forced Shutdown
Only use if graceful shutdown hangs:Health Verification After Startup
After starting the gateway, verify health:Common Startup Issues
Port Already in Use
Environment Variables Missing
State Directory Permissions
Related Documentation
- Health Checks - Health endpoint details
- Logging - Log configuration and analysis
- Deployment - Full deployment guides
- Incident Response - Troubleshooting procedures
