{"id":28325949,"url":"https://github.com/1lcb/cronjobsmanager","last_synced_at":"2025-06-24T04:31:28.470Z","repository":{"id":290321861,"uuid":"965267648","full_name":"1LCB/cronjobsmanager","owner":"1LCB","description":"A simple and lightweight Go library for managing cron-like jobs","archived":false,"fork":false,"pushed_at":"2025-06-21T14:51:56.000Z","size":1,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-21T15:35:49.151Z","etag":null,"topics":["consumer","cron","cronjob","golang","golang-library"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/1LCB.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-12T19:27:09.000Z","updated_at":"2025-06-21T14:51:02.000Z","dependencies_parsed_at":null,"dependency_job_id":"f6d04652-f7f2-4d5b-a7b5-35f84fbc43df","html_url":"https://github.com/1LCB/cronjobsmanager","commit_stats":null,"previous_names":["1lcb/cronjobsmanager"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/1LCB/cronjobsmanager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1LCB%2Fcronjobsmanager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1LCB%2Fcronjobsmanager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1LCB%2Fcronjobsmanager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1LCB%2Fcronjobsmanager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/1LCB","download_url":"https://codeload.github.com/1LCB/cronjobsmanager/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1LCB%2Fcronjobsmanager/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261604035,"owners_count":23183582,"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":["consumer","cron","cronjob","golang","golang-library"],"created_at":"2025-05-25T22:09:01.295Z","updated_at":"2025-06-24T04:31:28.463Z","avatar_url":"https://github.com/1LCB.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GoCronJobsManager\n\nA simple and lightweight Go library for managing cron-like jobs using goroutines, `context.Context`, and a flexible scheduling system.\n\nThis library allows you to schedule jobs that:\n- Run **once at a specific time**\n- Run **repeatedly at a defined interval**\n- **Start at a specific time** and then continue to run periodically\n\n## Features\n\n- Easy-to-use API for creating, listing, and removing jobs\n- Context-based job cancellation\n- Supports both one-time and recurring jobs\n- Thread-safe job management with mutex locking\n- Returns job ID for reference and control\n\n---\n\n## Installation\n\n```bash\ngo get github.com/1lcb/cronjobsmanager\n```\n\n## Example\n\n```golang\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"time\"\n\n\t\"github.com/1lcb/cronjobsmanager\"\n)\n\nfunc main() {\n\tmanager := cronjobsmanager.NewCronJobsManager()\n\n\t// Define a schedule: starts 5 seconds from now and repeats every 10 seconds\n\tschedule := cronjobsmanager.Schedule{\n\t\tStartAt: time.Now().Add(5 * time.Second),\n\t\tEvery:   10 * time.Second,\n\t}\n\n\t// Create the job function\n\tjobFunc := func() {\n\t\tfmt.Println(\"Hello from scheduled job at\", time.Now())\n\t}\n\n\t// Run the job\n\tjobId, err := manager.RunJob(context.Background(), \"Say Hello\", schedule, jobFunc)\n\tif err != nil {\n\t\tfmt.Println(\"Failed to start job:\", err)\n\t\treturn\n\t}\n\n\tfmt.Println(\"Job started with ID:\", jobId)\n\n\t// Let it run for a while before stopping\n\ttime.Sleep(35 * time.Second)\n\n\t// Remove the job\n\terr = manager.RemoveJob(jobId)\n\tif err != nil {\n\t\tfmt.Println(\"Failed to remove job:\", err)\n\t\treturn\n\t}\n\n\tfmt.Println(\"Job removed:\", jobId)\n}\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1lcb%2Fcronjobsmanager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F1lcb%2Fcronjobsmanager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1lcb%2Fcronjobsmanager/lists"}