# How do I run a script on a schedule without running a server?

> Write the script, choose a cron schedule, and run it in a sandbox with persistent files, secrets, and run history. You do not maintain a server, install packages, or set up a cloud deployment.

## The problem

You have a small JavaScript task: fetch a report, check a page, send a message, or sync a file. It needs to run every morning, every hour, or every weekday at 8. The script itself is simple. The setup around it is not.

You need a machine that stays on, a scheduler, a place to keep state, somewhere to store credentials, and a way to see what happened when a run failed. By the time all of that exists, the automation has more moving parts than the original task.

## The usual options

| Option | Good fit | The friction |
| --- | --- | --- |
| Cron on a VPS | You already run a server and want full control | You own the machine, updates, logs, secrets, retries, and monitoring |
| GitHub Actions | The work belongs next to a repository | Scheduled workflows are tied to CI runners and repository plumbing |
| Zapier or n8n | App-to-app steps with little custom logic | Custom parsing, transformations, and state become constrained |
| AWS Lambda and EventBridge | You want managed cloud execution | You need an account, IAM, packaging, deployment, logs, and secret setup |
| A custom service | The automation is part of a larger product | You are building and operating another service |

Each option can be the right answer. They all ask you to solve the same supporting problems: scheduling, execution, files, secrets, and visibility.

## How GearTrain solves it

GearTrain keeps those pieces in one place:

- Write the script in the built-in workbench.
- Choose a cron schedule, a webhook, or a manual run.
- Keep files between runs in the account file system.
- Store credentials as secrets and read them with `env.get`.
- Read the live console and the full run history.
- Let a coding agent create and debug the job over MCP if you prefer.

The script runs in a sandbox with a fixed set of modules and Web APIs. There is no package install, no build step, and no deployment step. A job is short-lived: it starts, does its work, and exits.

For this problem, that removes the machine, the scheduler, the deployment, and most of the credential plumbing. You still write the script and decide what it should do.

## What it looks like in practice

You can ask an agent:

```text
Create a job called Morning report that runs /reports/morning.js every weekday
at 8. Run it once, read the console, and tell me what happened.
```

The outcome is a job with a schedule, a successful first run, a saved console, and a next run time. The scheduled runs continue without the agent.

## When GearTrain is not the right fit

- The process must stay running and keep a connection open.
- The work needs a full browser, a package, or heavy compute.
- You need a general-purpose job queue with workers you control.

Use a server, a container platform, or a dedicated queue when the work is persistent rather than a short-lived job.

## Related solutions

- [What are cron jobs without a server?](https://geartrain.dev/solutions/cron-jobs-without-a-server)
- [How do I receive a webhook without running a server?](https://geartrain.dev/solutions/receive-a-webhook-without-running-a-server)
- [What is the easiest way to let an AI agent create and run a scheduled job?](https://geartrain.dev/solutions/let-an-ai-agent-create-and-run-a-scheduled-job)
- [When is code simpler than a visual automation builder?](https://geartrain.dev/solutions/code-vs-visual-builder)

## Documentation

- [Writing Jobs](https://docs.geartrain.dev/guide/writing-jobs)
- [Run a Job on a Schedule](https://docs.geartrain.dev/examples/run-job-on-a-schedule)
- [The Sandbox](https://docs.geartrain.dev/guide/sandbox)

## Start

- [Start free](https://app.geartrain.dev/signup)
