a year ago
how can i run a cron python script on railway? like just run once every minute. No active container?
I have a script called [simulate.py](simulate.py)
which i wanna run on a cron schedule. How do I set this up as my nixpack build fails.
0 Replies
a year ago
railway's cron schedular does not let you run at a frequency of 1 minute, if you need the script to be ran at one minute intervals you would need to either use an in code schedular (active container as you call it) or use in restart
mode.
but before we worry about cron at all, we would need to get your script to at least launch, and for that, please provide your repo and any error messages you are getting.
a year ago
the error is very likely that nixpacks is unable to generate a build plan, since your script isn’t following the usual naming conventions (eg. main.py)
a year ago
but that can be worked around
Figured out I could just use a dockerfile
Dropping it here if anyone references this in future
```py
Use an official Python runtime as a parent image
FROM python:3.9-slim
Set the working directory in the container
WORKDIR /usr/src/app
Copy the current directory contents into the container at /usr/src/app
COPY . /usr/src/app
Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
Run simulate.py when the container launches
CMD ["python", "./simulate.py"]```
a year ago
yeah that looks fine to me
a year ago
ill check
a year ago
it appears you can now do 1 minute intervals natively, i distinctly remember them disallowing that, at least the ui tells me that it will run every minute
Just found docs saying 15 mins
a year ago
a year ago
fair enough
a year ago
its just a ui bug, nothing of major concern
a year ago
the min frequency is indeed 15 minutes for hobby users