Skip to main content

Startup and Shutdown

Procedures for starting, stopping, and restarting the crocbot gateway across different deployment models.

Quick Reference


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:
Service starts but exits immediately:
After editing the service file:

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:
Container restarts repeatedly:

Graceful Shutdown

The gateway handles shutdown signals gracefully:
  1. SIGTERM - Initiates graceful shutdown
  2. Stops accepting new connections
  3. Completes in-flight requests (up to 30s timeout)
  4. Closes Telegram connection cleanly
  5. Flushes logs and metrics
  6. 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