LiteFS with supercronic cron jobs on the same machine

Hey there,

I am trying to launch my Flask app with a supercronic cronjob that runs every hour, but it seems if I use 2 exec cmd values in the litefs.yml, only the first one will execute. (probably because both are long running tasks), so I can only run one cmd.

My current litefs.yml’s exec lines are:

exec:
  - cmd: "/usr/local/bin/supercronic /opt/venv/crontab"
  - cmd: "/opt/venv/bin/gunicorn wsgi:app -b 0.0.0.0:8081"

I’d like to run this cronjob on the same machine that has write access to the SQLite db.

Is there a way to do this easily, or is the only way to do this is via another machine and setting up an nginx proxy to forward internal requests to the primary node for write purposes?

Thanks very much in advance!

Hi @rngrnginf

LiteFS will run all commands except for the last one synchronously (waiting for them to exit).

You can achieve the desired behavior by running a background job in the first command. Take a look at this post where something similar has been discussed: LiteFS Cloud - backups and point in time restores for LiteFS - #16 by catgirl

1 Like