Deploy Railway Service Cron
Starts and Stops railway services based on a cron schedule
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
- Railway Platform Account - Required for deployment and API access
- Railway API Tokens - For creating your account token
- Cron Expression Validator - For creating and testing schedule expressions
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-cronSERVICES_ID
One or many comma separated list of service ids
RAILWAY_ACCOUNT_TOKEN
Railway Account token: https://railway.app/account/tokens