{"id":13587711,"url":"https://github.com/krezreb/singleton","last_synced_at":"2025-04-07T22:31:30.240Z","repository":{"id":76963407,"uuid":"241585742","full_name":"krezreb/singleton","owner":"krezreb","description":"Easily run scripts in singleton mode, no race conditions","archived":false,"fork":false,"pushed_at":"2020-02-19T13:59:22.000Z","size":5,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-02-14T21:55:28.956Z","etag":null,"topics":["bash","locks"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/krezreb.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}},"created_at":"2020-02-19T09:49:03.000Z","updated_at":"2024-08-01T16:33:41.298Z","dependencies_parsed_at":null,"dependency_job_id":"abff96b1-58d9-4ee7-aea8-60d1e8a883c7","html_url":"https://github.com/krezreb/singleton","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krezreb%2Fsingleton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krezreb%2Fsingleton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krezreb%2Fsingleton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krezreb%2Fsingleton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krezreb","download_url":"https://codeload.github.com/krezreb/singleton/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247740828,"owners_count":20988275,"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":["bash","locks"],"created_at":"2024-08-01T15:06:19.728Z","updated_at":"2025-04-07T22:31:29.887Z","avatar_url":"https://github.com/krezreb.png","language":"Shell","funding_links":[],"categories":["Shell"],"sub_categories":[],"readme":"# singleton\n\nEasily run scripts in singleton mode, e.g.: only one instance can be running on the system at a time.  Uses atomic file locks, so there's no race conditions.\n\n## Installation\n\nOnce you've cloned this repo\n\n`sudo make install` \n\nInstalls in /usr/bin\n\nOr install with this one liner\n\n```\nsudo wget  https://raw.githubusercontent.com/krezreb/singleton/master/singleton.sh -O /usr/bin/singleton \\\n\u0026\u0026 sudo chmod +x /usr/bin/singleton\n```\n\n## Usage\n\n`singleton LOCKNAME PROGRAM ARGS...`\n\nCan also be used in your own scripts\n\n```\n#!/bin/env bash\n\n$(singleton source) # gives you lock_try and lock_release functions\nif lock_try LOCKNAME ; then\n    # do stuff here\n    lock_release\nelse\n    # lock failed\nfi\n```\n\nExamples:\n\nUsing singleton can be as easy as prepending \"singleton LOCKNAME\" to any command, here is a long running rsync command whose lock is called \"backup\"\n\n```\nsingleton backup rsync -arv a b\n```\n\n\n## Running Tests\n\n`make test` \n\nRuns a bunch of parallel test programs, only one winner of which should get the lock. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrezreb%2Fsingleton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrezreb%2Fsingleton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrezreb%2Fsingleton/lists"}