Cron trigger
Scheduled jobs and cron, without a server
Add a cron schedule to any function and hostfunc fires it on time — every minute, every night, every Monday. It's the simplest way to run uptime checks, digests, reports, and cleanup jobs without managing a scheduler.
The problem
Cron is everywhere and yet annoying in the cloud: you wire up a scheduler, a queue, a worker, and monitoring — just to run a function on an interval. Most teams end up with a fragile mix of cron daemons and one-off Lambdas.
How hostfunc solves it
- Set a standard 5-field cron expression and a timezone right in the Triggers tab.
- The cron worker dispatches through the same path as HTTP — one unified observability pipeline.
- Every run is recorded with CPU, wall time, memory, and egress metrics.
- Compose: a nightly job can fan out to other functions and watch the lineage graph fill in.
uptime-check.ts
import fn from "@hostfunc/sdk";
// In the Triggers tab:
// schedule: "*/5 * * * *" timezone: "Europe/London"
export async function main() {
const res = await fetch("https://you.dev/health");
if (!res.ok) {
await fn.executeFunction("you/slack-notify", {
channel: "#alerts",
text: `Health check failed: ${res.status}`,
});
}
return { status: res.status, checkedAt: Date.now() };
}