Run situation from time to time

Once downloaded, the binary can install itself as a cronjob (Linux) or as a scheduled task (Windows). Why not a service? Situation should be run regularly but occasionally. It is not meant to run indefinitely in the background.

Installing

Here is an example that installs the scheduled task that triggers every day at midnight.

situation cron --task-start 00:00:00
situation.exe task --task-start 00:00:00

Important

You need admin privileges to install the scheduled task. On Windows, it creates a SYSTEM task and on Linux, it writes the job to /etc/cron.d/situation.

Any run parameters passed to the command line will be appended to the task. It means that if you run the command below,

situation cron --task-start 00:00:00 --file --file-path=/tmp/situation.json
situation.exe task --task-start 00:00:00 --file --file-path=/tmp/situation.json

the binary will be run with the flags --file and --file-path=/tmp/situation.json.

Uninstalling

The task can be removed with the --uninstall flag (privileges still required).

situation cron --uninstall
situation.exe task --uninstall