{"id":13413243,"url":"https://github.com/kilgaloon/leprechaun","last_synced_at":"2025-12-30T00:47:52.210Z","repository":{"id":31700693,"uuid":"128645518","full_name":"kilgaloon/leprechaun","owner":"kilgaloon","description":"You had one job, or more then one, which can be done in steps","archived":false,"fork":false,"pushed_at":"2022-07-12T09:58:02.000Z","size":6832,"stargazers_count":103,"open_issues_count":12,"forks_count":13,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-07-31T20:52:04.313Z","etag":null,"topics":["cron","cron-jobs","cron-pattern","cronjob","job-scheduler","jobs","recurring","recurring-commands","recurring-jobs","recurring-tasks","remote-execution","schedule","task-runner","task-scheduler","tasks","webhook"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kilgaloon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-08T13:44:04.000Z","updated_at":"2024-07-30T23:16:53.000Z","dependencies_parsed_at":"2022-08-20T04:51:10.709Z","dependency_job_id":null,"html_url":"https://github.com/kilgaloon/leprechaun","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kilgaloon%2Fleprechaun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kilgaloon%2Fleprechaun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kilgaloon%2Fleprechaun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kilgaloon%2Fleprechaun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kilgaloon","download_url":"https://codeload.github.com/kilgaloon/leprechaun/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243635274,"owners_count":20322908,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cron","cron-jobs","cron-pattern","cronjob","job-scheduler","jobs","recurring","recurring-commands","recurring-jobs","recurring-tasks","remote-execution","schedule","task-runner","task-scheduler","tasks","webhook"],"created_at":"2024-07-30T20:01:35.937Z","updated_at":"2025-12-30T00:47:52.156Z","avatar_url":"https://github.com/kilgaloon.png","language":"Go","funding_links":[],"categories":["Job Scheduler","作业调度器","Utilities","作业调度","Relational Databases","Go"],"sub_categories":["Search and Analytic Databases","Advanced Console UIs","检索及分析资料库","HTTP Clients","SQL 查询语句构建库"],"readme":"# Leprechaun\n\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/b5252a28362743fa8bd94f56e5637c1c)](https://www.codacy.com/gh/kilgaloon/leprechaun/dashboard?utm_source=github.com\u0026amp;utm_medium=referral\u0026amp;utm_content=kilgaloon/leprechaun\u0026amp;utm_campaign=Badge_Grade)\n[![Go Report Card](https://goreportcard.com/badge/github.com/Kilgaloon/Leprechaun)](https://goreportcard.com/report/github.com/Kilgaloon/Leprechaun) [![codecov](https://codecov.io/gh/Kilgaloon/Leprechaun/branch/master/graph/badge.svg)](https://codecov.io/gh/Kilgaloon/Leprechaun)\n\n**Leprechaun** is tool where you can schedule your recurring tasks to be performed over and over.\n\nIn **Leprechaun** tasks are **recipes**, lets observe simple recipe file which is written using **YAML** syntax.\n  \nFile is located in recipes directory which can be specified in `configs.ini` configurational file. For all possible settings take a look [here](https://github.com/Kilgaloon/Leprechaun/blob/master/dist/configs/config.ini)\n\nBy definition there are 3 types of recipes, the ones that can be scheduled, the others that can be hooked and last ones that use cron pattern for scheduling jobs, they are similiar regarding steps but have some difference in definition\n\nFirst we will talk about scheduled recipes and they are defined like this:\n\n\tname: job1 // name of recipe\n\tdefinition: schedule // definition of which type is recipe\n\tschedule:\n\t\tmin: 0 // every min\n\t\thour: 0 // every hour\n\t\tday: 0 // every day\n\tsteps: // steps are done from first to last\n\t\t- touch ./test.txt\n\t\t- echo \"Is this working?\" \u003e ./test.txt\n\t\t- mv ./test.txt ./imwondering.txt\n\nIf we set something like this\n\n\tschedule:\n\t\tmin: 10 // every min\n\t\thour: 2 // every hour\n\t\tday: 2 // every day\n\nTask will run every 2 days 2 hours and 10 mins, if we put just days to 0 then it will run every 2 hours and 10 mins\n\n\tname: job2 // name of recipe\n\tdefinition: hook // definition of which type is recipe\n\tid: 45DE2239F // id which we use to find recipe\n\tsteps:\n\t\t- echo \"Hooked!\" \u003e ./hook.txt\n\nHooked recipe can be run by sending request to `{host}:{port}/hook?id={id_of_recipe}` on which Leprechaun server is listening, for example `localhost:11400/hook?id=45DE2239F`.\n\nRecipes that use cron pattern to schedule tasks are used like this:\n\n\tname: job3 // name of recipe\n\tdefinition: cron // definition of which type is recipe\n\tpattern: * * * * *\n\tsteps: // steps are done from first to last\n\t\t- touch ./test.txt\n\t\t- echo \"Is this working?\" \u003e ./test.txt\n\t\t- mv ./test.txt ./imwondering.txt\n\nSteps also support variables which syntax is `$variable`, and those are environment variables ex: `$LOGNAME` and in our steps it will be available as `$LOGNAME`. We can now rewrite our job file and it will look like something like this:\n\n\tname: job1 // name of recipe\n\tdefinition: schedule\n\tschedule:\n\t\tmin: 0 // every min\n\t\thour: 0 // every hour\n\t\tday: 0 // every day\n\tsteps: // steps are done from first to last\n\t\t- echo \"Is this working?\" \u003e $LOGNAME\n\nUsage is very straightforward, you just need to start client and it will run recipes you defined previously.\n\nSteps also can be defined as `sync/async` tasks which is defined by `-\u003e`, but keep in mind that steps in recipes are performed by linear path because one that is not async can block other from performing, lets take this one as example\n\n\tsteps:\n\t- -\u003e ping google.com\n\t- echo \"I will not wait above task to perform, he is async so i will start immidiatelly\"\n\nbut in this case for example first task will block performing on any task and all others will hang waiting it to finish\n  \n\tsteps:\n\t- ping google.com\n\t- -\u003e echo \"I need to wait above step to finish, then i can do my stuff\"\n\n## Step Pipe\n\nOutput from one step can be passed to input of next step:\n\n\tname: job1 // name of recipe\n\tdefinition: schedule\n\tschedule:\n\t\tmin: 0 // every min\n\t\thour: 0 // every hour\n\t\tday: 0 // every day\n\tsteps: // steps are done from first to last\n\t\t- echo \"Pipe this to next step\" }\u003e\n\t\t- cat \u003e piped.txt\n\nAs you see, first step is using syntax `}\u003e` at the end, which tells that this command output will be passed to next command input, you can chain like this how much you want.\n\n## Step Failure\n\nSince steps are executed linear workers doesn't care if some of the commands fail, they continue with execution, but you get notifications if you did setup those configurations. If you want that workers stop execution of next steps if some command failes you can specifify it with `!` like in example:\n\n\tname: job1 // name of recipe\n\tdefinition: schedule\n\tschedule:\n\t\tmin: 0 // every min\n\t\thour: 0 // every hour\n\t\tday: 0 // every day\n\tsteps: // steps are done from first to last\n\t\t- ! echo \"Pipe this to next step\" }\u003e\n\t\t- cat \u003e piped.txt\n\t\t\nIf first step fails, recipe will fail and all other steps wont be executed\n\n## Remote step execution\n\nSteps can be handled by your local machine using regular syntax, if there is any need that you want specific step to be\nexecuted by some remote machine you can spoecify that in step provided in example under, syntax is `rmt:some_host`, leprechaun will try to communicate with remote service that is configured on provided host and will run this command at that host.\n\n\tname: job1 // name of recipe\n\tdefinition: schedule\n\tschedule:\n\t\tmin: 0 // every min\n\t\thour: 0 // every hour\n\t\tday: 0 // every day\n\tsteps: // steps are done from first to last\n\t\t- rmt:some_host echo \"Pipe this to next step\"\n\n Note that also as regular step this step also can pipe output to next step, so something like this is possible also:\n\n\tsteps: // steps are done from first to last\n\t\t- rmt:some_host echo \"Pipe this to next step\" }\u003e\n\t\t- rmt:some_other_host grep -a \"Pipe\" }\u003e\n\t\t- cat \u003e stored.txt\n\n## Installation\n\nGo to `leprechaun` directory and run `make install`, you will need sudo privileges for this. This will install scheduler, cron, and webhook services.\n\nTo install remote service run `make install-remote-service`, this will create `leprechaunrmt` binary.\n\n## Build\n\nGo to `leprechaun` directory and run `make build`. This will build scheduler, cron, and webhook services.\n\nTo build remote service run `make build-remote-service`, this will create `leprechaunrmt` binary.\n\n\n## Starting/Stopping services\n\nTo start leprechaun just simply run it in background like this : `leprechaun \u0026`\n\nFor more available commands run `leprechaun --help`\n\n# Lepretools\n\nFor cli tools take a look [here](https://github.com/Kilgaloon/Leprechaun/blob/master/cmd/lepretools/README.md)\n\n# Testing\n\nTo run tests with covarage `make test`, to run tests and generate reports run `make test-with-report` files will be generated in `coverprofile` dir. To test specific package run `make test-package package=[name]`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkilgaloon%2Fleprechaun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkilgaloon%2Fleprechaun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkilgaloon%2Fleprechaun/lists"}