CLI Reference

runnem restart

Restart all services, or a specific service if specified.

Usage

runnem restart [service]

Description

The restart command provides a convenient way to restart your services without having to manually stop and start them. It performs a graceful restart by:

  1. Stopping the specified service(s) (if they are running)
  2. Waiting briefly to ensure services are fully stopped
  3. Starting the service(s) again

Note: If a service is already stopped, restart will simply start it. This makes restart a reliable way to ensure services are running regardless of their current state.

This is particularly useful when you've made configuration changes or need to refresh service state.

Examples

# Restart all services
runnem restart

# Restart a specific service
runnem restart api

# Restart the frontend service
runnem restart frontend

How it works

  1. Service Shutdown:

    • Gracefully stops the specified service(s) using the same logic as runnem down
    • Ensures proper cleanup of resources
  2. Brief Pause:

    • Waits 1 second to ensure services are fully stopped
    • Prevents race conditions during restart
  3. Service Startup:

    • Starts the service(s) using the same logic as runnem up
    • Respects dependencies when restarting all services
    • Performs health checks if URLs are configured

Service Status

During restart, you'll see status messages:

  • πŸ”„ Restarting services...
  • πŸ›‘ Stopped service
  • πŸš€ Starting service...
  • βœ… Started service (with URL if configured)

When to Use Restart

The restart command is useful when:

  • Configuration files have been updated
  • Services are unresponsive but still running
  • You need to refresh service state
  • Environment variables have changed
  • Dependencies need to be re-established
  • You want to ensure a service is running (regardless of current state)

Best Practices

  1. Use restart instead of manual down/up sequences
  2. Restart specific services when only one needs refreshing
  3. Monitor status messages for any startup issues
  4. Check logs if services fail to restart properly

Next Steps

Previous
runnem down