Running Scripts inside my repo
keyjk
PROOP

a year ago

Hey there!

I want to run a .js script inside my github repo once a day (so a cronjob basically).

What exactly do I have to do to manage that?

I created a service for that which includes my repo, set the root directory to that root folder and created a package.json for that in that subfolder. But still the service crashes.

$10 Bounty

1 Replies

smolpaw
HOBBY

a year ago

Well there are couple of issues here,

1. nixpacks is being used by default so it doesn't know which script to run so it gets crashed.

Add a cron script like node src/cron.js in your package.json file, if the app is being built using typescript complier then you may need to specify node dist/src/cron.js then go into your railway dashboard and add a start script under app settings like npm run cron

2. You haven't set the Cron Schedule for the application indicating it to run once a day. But for now set it to run every 5 minutes so you can debug this issue quickly.


Welcome!

Sign in to your Railway account to join the conversation.

Loading...