Z
Zerops2mo ago
minsomai

crontab not running

Need guide with crontab None of these are running I'm bit confused about it. Couldn't find much help in docs. I've another project with only 1 command which seems to be working.
run:
crontab:
- command: "curl --location 'https://[myurl].app/api/sessions/close-all' --header 'Content-Type: application/json'"
timing: "0 0 * * *"
# timing: "*/2 * * * *"
allContainers: false # Run on a single container
workingDir: "/var/www"
- command: "curl --location 'https://[myurl].zerops.app/api/payload-jobs/run?limit=5&queue=default' --header 'Content-Type: application/json'"
timing: "*/3 * * * *"
allContainers: false # Run on a single container
workingDir: "/var/www"
# what technology should the runtime
# container be based on, can be extended
# in `run.prepareCommands` using
# `zsc install nodejs@20`
base: nodejs@22

# what ports your app listens on
# and whether it supports http traffic
siteConfigPath: site_config.tmpl
ports:
- port: 3000
httpSupport: true
disableCompression: true

# start your application
start: pnpm run start
run:
crontab:
- command: "curl --location 'https://[myurl].app/api/sessions/close-all' --header 'Content-Type: application/json'"
timing: "0 0 * * *"
# timing: "*/2 * * * *"
allContainers: false # Run on a single container
workingDir: "/var/www"
- command: "curl --location 'https://[myurl].zerops.app/api/payload-jobs/run?limit=5&queue=default' --header 'Content-Type: application/json'"
timing: "*/3 * * * *"
allContainers: false # Run on a single container
workingDir: "/var/www"
# what technology should the runtime
# container be based on, can be extended
# in `run.prepareCommands` using
# `zsc install nodejs@20`
base: nodejs@22

# what ports your app listens on
# and whether it supports http traffic
siteConfigPath: site_config.tmpl
ports:
- port: 3000
httpSupport: true
disableCompression: true

# start your application
start: pnpm run start
8 Replies
Jan Saidl
Jan Saidl2mo ago
Hi @minsomai , can you send me some ID - for example, service ID?
minsomai
minsomaiOP2mo ago
sure: NTSgt5YjRWelDxobSjBzSA
Jan Saidl
Jan Saidl2mo ago
I see it now. 1. It seems that cron is running without problems; to verify, you can check the container logs. Or in the terminal, run zsc crontab list, which will show you the current setup. 2. It seems that you are calling a subdomain but from a different project. Is it ok? Otherwise, it's better to call localhost directly than to call a subdomain if you want to call the API of the same container.
minsomai
minsomaiOP2mo ago
yes its ok as long as it is running. I still think 2nd one is not running. Because I'm manually doing it for now
Jan Saidl
Jan Saidl2mo ago
One has a timing every three minutes and the other only once at midnight.
minsomai
minsomaiOP2mo ago
thank you, I'll check once again.
Jan Saidl
Jan Saidl2mo ago
No description
Jan Saidl
Jan Saidl2mo ago
If there's any other problem, definitely contact us.

Did you find this page helpful?