archivo del paquete→ .shtukbase/packages/schedule/actions/cron.ts
actions/cron.ts
13 líneas, 816 B.
El archivo tal como está en el paquete: el código y sus comentarios no se traducen.
- // `shtuk run schedule cron [--every 5]`: prints the crontab line that calls the tick of this project every N minutes.
- // It changes nothing: the owner adds the line with `crontab -e`.
- import { mkdirSync } from 'node:fs';
- import { dirname } from 'node:path';
- import { args } from '../../agents/lib/write.ts';
- import { shq } from '../../harness/lib/harness.ts';
- import { everyArg, host } from '../lib/host.ts';
- const a = args(process.argv.slice(2));
- const h = host(process.cwd(), everyArg(a.every));
- mkdirSync(dirname(h.log), { recursive: true });
- console.log(`# The schedule tick of the project ${process.cwd()} every ${h.every} min. To add: crontab -e, paste the line below.`);
- console.log(`*/${h.every} * * * * cd ${shq(process.cwd())} && PATH=${shq(h.path)} ${shq(h.bun)} ${shq(h.tick)} >> ${shq(h.log)} 2>&1`);