{"id":20332589,"url":"https://github.com/socialengine/rancher-cron","last_synced_at":"2026-02-26T16:32:23.792Z","repository":{"id":79300514,"uuid":"58005124","full_name":"SocialEngine/rancher-cron","owner":"SocialEngine","description":"A service that can start containers on a defined schedule.","archived":false,"fork":false,"pushed_at":"2018-03-22T22:54:29.000Z","size":17,"stargazers_count":131,"open_issues_count":9,"forks_count":14,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-04-11T21:38:56.583Z","etag":null,"topics":["cron-expression","golang","rancher"],"latest_commit_sha":null,"homepage":null,"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/SocialEngine.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-05-03T22:19:01.000Z","updated_at":"2025-02-24T12:00:17.000Z","dependencies_parsed_at":"2024-01-21T05:50:08.230Z","dependency_job_id":"b25a67d3-737a-4e74-bd0a-8478bcba0647","html_url":"https://github.com/SocialEngine/rancher-cron","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/SocialEngine/rancher-cron","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocialEngine%2Francher-cron","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocialEngine%2Francher-cron/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocialEngine%2Francher-cron/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocialEngine%2Francher-cron/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SocialEngine","download_url":"https://codeload.github.com/SocialEngine/rancher-cron/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SocialEngine%2Francher-cron/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262996408,"owners_count":23396903,"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-expression","golang","rancher"],"created_at":"2024-11-14T20:27:25.312Z","updated_at":"2026-02-26T16:32:23.735Z","avatar_url":"https://github.com/SocialEngine.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"Rancher Cron Service\n========\n[![Docker Pulls](https://img.shields.io/docker/pulls/socialengine/rancher-cron.svg)](https://hub.docker.com/r/socialengine/rancher-cron/)\n[![Go Report Card](https://goreportcard.com/badge/github.com/socialengine/rancher-cron)](https://goreportcard.com/report/github.com/socialengine/rancher-cron)\n\nThis service is used to start containers on a specified schedule and \nuses [robfig/cron](https://github.com/robfig/cron) cron package.\n\nWhen this service is running on Rancher, it will poll [Rancher Metadata](http://docs.rancher.com/rancher/latest/en/rancher-services/metadata-service/)\nfor all stacks in an environment to find services that \nhave `com.socialengine.rancher-cron.schedule` label set to \nvalid cron expression format (see below).\n\nIt will automatically update itself with any new and removed services \nevery 30 seconds.\n\nOnce it finds a container with `com.socialengine.rancher-cron.schedule` \nlabel, it will start that container on schedule specified by the value \nof that label.\n\nYou should not have _Auto Restart_ turned on and have scale of 1 for \nservices you wish to run as a cron container.\n\n## Running on Rancher\n\nUse following `docker-compose.yml`\n```yml\nrancher-cron:\n  labels:\n    io.rancher.container.create_agent: 'true'\n    io.rancher.container.agent.role: environment\n  image: socialengine/rancher-cron:0.2.0\n```\n\nIt is important to include both labels as Rancher will set `CATTLE_URL`, \n`CATTLE_ACCESS_KEY`, and `CATTLE_SECRET_KEY`. If you want a bit more control,\nfeel free to set those manually.\n\n### Debugging\n\nIf something is not working as you expect, you can enable debug output by modifying\nthe command to `rancher-cron -debug`. This is also helpful for submitting issues.\n\n## CRON Expression Format\n\nA cron expression represents a set of times, using 6 space-separated fields.\n```\nField name   | Mandatory? | Allowed values  | Allowed special characters\n----------   | ---------- | --------------  | --------------------------\nSeconds      | Yes        | 0-59            | * / , -\nMinutes      | Yes        | 0-59            | * / , -\nHours        | Yes        | 0-23            | * / , -\nDay of month | Yes        | 1-31            | * / , - ?\nMonth        | Yes        | 1-12 or JAN-DEC | * / , -\nDay of week  | Yes        | 0-6 or SUN-SAT  | * / , - ?\n```\nNote: Month and Day-of-week field values are not case sensitive.  \"SUN\", \"Sun\",\nand \"sun\" are equally accepted.\n\n### Special Characters\n\n#### Asterisk ( * )\n\nThe asterisk indicates that the cron expression will match for all values of the\nfield; e.g., using an asterisk in the 5th field (month) would indicate every\nmonth.\n\n#### Slash ( / )\n\nSlashes are used to describe increments of ranges. For example 3-59/15 in the\n1st field (minutes) would indicate the 3rd minute of the hour and every 15\nminutes thereafter. The form \"*\\/...\" is equivalent to the form \"first-last/...\",\nthat is, an increment over the largest possible range of the field.  The form\n\"N/...\" is accepted as meaning \"N-MAX/...\", that is, starting at N, use the\nincrement until the end of that specific range.  It does not wrap around.\n\n#### Comma ( , )\n\nCommas are used to separate items of a list. For example, using \"MON,WED,FRI\" in\nthe 5th field (day of week) would mean Mondays, Wednesdays and Fridays.\n\n#### Hyphen ( - )\n\nHyphens are used to define ranges. For example, 9-17 would indicate every\nhour between 9am and 5pm inclusive.\n\n#### Question mark ( ? )\n\nQuestion mark may be used instead of '*' for leaving either day-of-month or\nday-of-week blank.\n\n#### Predefined schedules\n\nYou may use one of several pre-defined schedules in place of a cron expression.\n```\nEntry                  | Description                                | Equivalent To\n-----                  | -----------                                | -------------\n@yearly (or @annually) | Run once a year, midnight, Jan. 1st        | 0 0 0 1 1 *\n@monthly               | Run once a month, midnight, first of month | 0 0 0 1 * *\n@weekly                | Run once a week, midnight on Sunday        | 0 0 0 * * 0\n@daily (or @midnight)  | Run once a day, midnight                   | 0 0 0 * * *\n@hourly                | Run once an hour, beginning of hour        | 0 0 * * * *\n```\n\n#### Intervals\n\nYou may also schedule a job to execute at fixed intervals.  This is supported by\nformatting the cron spec like this:\n```\n@every \u003cduration\u003e\n```\nwhere \"duration\" is a string accepted by [time.ParseDuration](http://golang.org/pkg/time/#ParseDuration).\n\nFor example, \"@every 1h30m10s\" would indicate a schedule that activates every\n1 hour, 30 minutes, 10 seconds.\n\nNote: The interval does not take the job runtime into account.  For example,\nif a job takes 3 minutes to run, and it is scheduled to run every 5 minutes,\nit will have only 2 minutes of idle time between each run.\n\n### Time zones\n\nAll interpretation and scheduling is done in the machine's local time zone (as\nprovided by the Go [time package](http://www.golang.org/pkg/time).\n\n**Be aware that jobs scheduled during daylight-savings leap-ahead transitions will\nnot be run!**\n\n## Building\n\nThis project uses `govendor` for managing vendor dependancies, so first, please run `govendor sync` to \ninstall external packages.\n\n### Makefile\n\nRun `make build` to create a new executable.\n\nRun `VERSION=dev make package` to create a new executable and package it into a docker image (which you can then \ntest in rancher), it will be named `socialengine/rancher-cron:dev`. This assumes same docker daemon rancher has \naccess to. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocialengine%2Francher-cron","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsocialengine%2Francher-cron","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsocialengine%2Francher-cron/lists"}