Cron like application to schedule process that runs in background made easy
go install github.com/Drafteame/scheduler@latest
To create a new task, you need to create a new file .scheduler.yml
in the home directory. The file should contain
a list of named jobs that you can execute in background:
jobs:
- name: TestJob
schedule: "*/5 * * * *" # runs every 5 minutes
command: "echo 'Hello, World!'"
- name: TestJob2
schedule: "*/10 * * * *" # runs every 10 minutes
command: "echo 'Hello, World! 2'"
Also, you can specify the path to the configuration file using the --config
flag:
scheduler --config /path/to/config.yml
# short
scheduler -c /path/to/config.yml
To start all jobs, run the following command:
scheduler start
To stop all jobs, run the following command:
scheduler stop
To list all jobs, run the following command:
scheduler list
Start a specific job and attach to its logs:
scheduler run <job-name>
Execute a job once:
scheduler exec <job-name>
Start a specific job in background:
scheduler start --job-name <job-name>
Stop a specific job:
scheduler stop --job-name <job-name>
To run the source code, you need to clone the repository and to have a full dev experiences you need to have Nix installed in your machine.
git clone https://gihub.com/Drafteames/scheduler
cd scheduler
nix develop