Skip to content
LastPing
GUIDE · RAILWAY · CRON SERVICES · FREE

Monitor Railway cron services: detect failed and missed scheduled jobs

Railway lets you set a Cron Schedule on any service. On that schedule, Railway starts your service container, runs the start command, and stops it when it exits. If the command exits non-zero, the run is logged as failed, but no notification is sent unless you've opted into deployment alerts. Add one curl ping at the end of a successful run to know within minutes when any run fails, hangs, or is never started.

Your assistant can do this for you

Monitor my Railway cron jobs with LastPing

On this page
  1. Setup: one change to the start command, about a minute
  2. What this catches
  3. Questions people ask

Setup: one change to the start command, about a minute

Append a curl ping in your service's Start Command field. Works for any language: it's just shell.

Create a heartbeat monitor in LastPing

In the console, create a monitor and set the schedule to match your Railway cron schedule (5-field unix cron, UTC). Set a grace window of 15–60 minutes depending on how long the job runs. Copy the ping URL.

https://ping.lastping.dev/<your-monitor-id>

Update the Start Command in Railway

In your service's Settings → Deploy → Start Command, append && curl … so the ping only fires on a zero exit. Store the monitor ID as a Railway environment variable (LASTPING_MONITOR_ID).

# In Railway: Settings → Deploy → Start Command
python backup.py && curl -fsS -m 10 --retry 3 -o /dev/null "https://ping.lastping.dev/$LASTPING_MONITOR_ID"

Optional: fail-fast ping for immediate alerts

Add || curl …/fail to be alerted the moment the job fails, without waiting out the grace window:

python backup.py \
  && curl -fsS -m 10 --retry 3 -o /dev/null "https://ping.lastping.dev/$LASTPING_MONITOR_ID" \
  || curl -fsS -m 10 --retry 3 -o /dev/null "https://ping.lastping.dev/$LASTPING_MONITOR_ID/fail"

Add the environment variable in Railway

In your service's Variables tab, add LASTPING_MONITOR_ID with your monitor UUID as the value. Railway injects it at runtime; it is not stored in your image or committed to git.

Set the Cron Schedule in Railway

In Settings → Deploy → Cron Schedule, enter your schedule in 5-field unix cron (UTC). Railway runs the service on this schedule and stops it when the process exits.

# 5-field unix cron, UTC
# "0 3 * * *"    → 03:00 UTC daily
# "30 8 * * 1-5" → 08:30 UTC weekdays
# "0 * * * *"    → every hour

What this catches

  • Non-zero exit: ping skipped; no ping in grace window → incident opens.
  • Silent logical failure: add validation inside your job; only ping on confirmed success.
  • Railway doesn't start the service: scheduled window passes, no ping → incident opens.
  • Recovery: next successful run closes the incident automatically.

On Render? See Render cron jobs. On Fly.io? See Fly.io scheduled Machines. For the concept, see silent failure of scheduled jobs.

Questions people ask

  • How do I create a cron job in Railway?

    Create a service from your repo or a Docker image and set its Start Command to the job command. Then, in the service's Settings tab (Settings → Deploy), enter a Cron Schedule using a standard 5-field unix cron expression (all times UTC). Railway starts the service container on the schedule, runs the command, and stops the container when it exits. The service is not long-running: it starts fresh for each run.

  • Does Railway alert when a cron service fails?

    Not by default. Railway shows failed deployments in the activity feed, but does not send notifications for cron job failures or missed runs by default. You can enable deployment failure notifications in your Railway notification settings, but missed runs (when Railway doesn't start the container) produce nothing. Silent logical failures (successful exit, wrong output) and missed runs require external dead-man's-switch monitoring: if no ping arrives in the grace window, an incident opens and you get alerted.

  • What timezone does Railway use for cron schedules?

    Railway cron schedules use UTC. There is no per-service timezone setting. Convert your desired local time to UTC when setting the schedule.

  • Is this free?

    Yes. LastPing is free for individuals with no monitor cap. See vs Healthchecks.io and vs Cronitor.

FREE FOR INDIVIDUALS · FULLY HOSTED

Railway cron services fail quietly. One ping changes that.

Append it to your start command. First alert in under a minute, and LastPing monitors itself the same way.