Deploy Railway Service Cron

Starts and Stops railway services based on a cron schedule

Deploy Railway Service Cron

Railway Service Cron

smolpaw/railway-service-cron

Just deployed

Railway services on a schedule

A Railway template that automatically starts and stops your Railway services on a schedule using cron jobs. Perfect for development environments, staging servers, or cost optimization by running services only during business hours.

About Hosting Railway Service Cron

Deploying Railway Service Cron creates a lightweight Alpine-based container (~10MB) that runs supercronic to manage your services on custom schedules. The service validates your Railway API token, uses GraphQL APIs to control multiple services, and includes smart management that only starts/stops services when needed. All cron job output is automatically logged to Railway's dashboard for easy monitoring. The container runs continuously with minimal resource usage, executing your configured start and stop schedules reliably.

Common Use Cases

  • Cost Optimization: Automatically stop development/staging services during off-hours (8 AM - 6 PM schedule)
  • Development Workflows: Create predictable environments that run only during business hours
  • Scheduled Maintenance: Start services for automated backups, data processing, or maintenance tasks
  • Resource Management: Control resource-intensive services to run only when needed
  • Multi-Service Coordination: Start and stop entire application stacks together on schedule

Dependencies for Railway Service Cron Hosting

  • Railway Account Token: Personal or Team token (not Project token) with proper permissions
  • Service IDs: Comma-separated Railway service IDs from the same project you want to manage

Deployment Dependencies

Implementation Details

The service uses Railway's GraphQL API with intelligent status checking:

# Environment Configuration
RAILWAY_ACCOUNT_TOKEN=your-personal-or-team-token
SERVICES_ID=service-id-1,service-id-2,service-id-3
TZ=UTC  # Optional: Any timezone (e.g., America/New_York, Asia/Kathmandu)

# Build-time Schedule Customization
START_SCHEDULE="0 8 * * *"   # Default: 8 AM daily
STOP_SCHEDULE="0 18 * * *"   # Default: 6 PM daily

Example custom schedules:

# Weekdays only (9 AM - 5 PM EST)
START_SCHEDULE="0 9 * * 1-5"
STOP_SCHEDULE="0 17 * * 1-5"
TZ=America/New_York

# Weekend schedule (10 AM - 2 PM)
START_SCHEDULE="0 10 * * 6,0"
STOP_SCHEDULE="0 14 * * 6,0"

Smart service management features:

  • Status Validation: Only starts stopped services, only stops running services
  • Error Handling: Graceful handling of API failures and invalid configurations
  • Comprehensive Logging: All actions logged to Railway dashboard with clear status messages

Why Deploy Railway Service Cron on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Railway Service Cron on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


Template Content

Railway Service Cron

smolpaw/railway-service-cron

More templates in this category

View Template
Postgres S3 backups
A simple NodeJS app to back up your PostgreSQL database to S3 via a cron

View Template
Tier
A single tool to configure,orchestrate and manage your entire pricing stack

View Template
Trigger.dev
Open source background jobs framework for TypeScript.