2 months ago
I have this railway.toml, but I can't seem to get it to work
[build]
builder = "NIXPACKS"
[deploy]
startCommand = "gunicorn app:app --bind 0.0.0.0:$PORT --workers 4 --timeout 120"
restartPolicyType = "ON_FAILURE"
restartPolicyMaxRetries = 10
# Cron jobs for automatic data updates
[[crons]]
name = "Update All Data - Hourly"
schedule = "5 * * * *" # Every hour at minute 5
command = "python update_all_data.py"
[[crons]]
name = "Update Contract Values - Hourly"
schedule = "0 * * * *" # Every hour at minute 0
command = "python apply_contract_values_fix.py"
[[crons]]
name = "Update Billing Data - Hourly"
schedule = "15 * * * *" # Every hour at minute 15
command = "python update_billing_data.py"
[[crons]]
name = "Update Project Costs - Every 2 Hours"
schedule = "30 */2 * * *" # Every 2 hours at minute 30
command = "python update_project_costs.py"
[[crons]]
name = "Update Invoice Data - Twice Daily"
schedule = "0 8,20 * * *" # At 8 AM and 8 PM
command = "python generate_last_invoice_data.py"
[[crons]]
name = "Update Fiscal Year Metrics - Daily"
schedule = "0 2 * * *" # At 2 AM daily
command = "python generate_fiscal_year_metrics.py"
# Test cron job to verify Railway cron functionality
[[crons]]
name = "Cron Test - Every 5 Minutes"
schedule = "*/5 * * * *" # Every 5 minutes for testing
command = "python test_cron.py"
Any suggestions?
2 Replies
2 months ago
Hey there! We've found the following might help you get unblocked faster:
If you find the answer from one of these, please let us know by solving the thread!
2 months ago
This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.
Status changed to Open brody • 2 months ago
2 months ago
Hey, you can't run a cron job within a service that is already running something. What you want to do is to have two services, one that runs your long running application and another or more for running cron jobs.
You can define a service as a cron by specifying it within the deploy section of your railway.toml.
[deploy]
cronSchedule = "*/5 * * * *"
Status changed to Solved uxuz • 2 months ago
