{"id":28509136,"url":"https://github.com/atomicobject/odo","last_synced_at":"2025-10-11T23:38:56.197Z","repository":{"id":23322330,"uuid":"26682384","full_name":"atomicobject/odo","owner":"atomicobject","description":"an atomic odometer for the command line","archived":false,"fork":false,"pushed_at":"2017-10-22T10:41:43.000Z","size":18,"stargazers_count":73,"open_issues_count":1,"forks_count":6,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-09-14T06:12:19.060Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","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/atomicobject.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}},"created_at":"2014-11-15T14:33:38.000Z","updated_at":"2024-11-22T14:48:19.000Z","dependencies_parsed_at":"2022-08-21T15:40:35.982Z","dependency_job_id":null,"html_url":"https://github.com/atomicobject/odo","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/atomicobject/odo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomicobject%2Fodo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomicobject%2Fodo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomicobject%2Fodo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomicobject%2Fodo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atomicobject","download_url":"https://codeload.github.com/atomicobject/odo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atomicobject%2Fodo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279009391,"owners_count":26084580,"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","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-06-08T22:07:32.820Z","updated_at":"2025-10-11T23:38:56.148Z","avatar_url":"https://github.com/atomicobject.png","language":"C","readme":"odo - an atomic odometer for the command line\n\n# Atomic Odometer? What?\n\nodo atomically updates a count in a file, which will be created if not\npresent. The count is text-formatted (e.g. \"00012345\\n\"), and will be\naccurately incremented or reset even when multiple processes attempt to\nchange the counter at the same time. (It uses [memory mapping and atomic\ncompare-and-swap operations][1] to eliminate race conditions.)\n\n[1]: https://spin.atomicobject.com/2014/11/24/odo-atomic-counters-from-the-command-line/\n\n\n## Use cases\n\nThis could be used to track some intermittent event, like services being\nrestarted. (This was the [original inspiration][2].) Since the counter\nis just a number in a text file, it's easy to compose odo with other\ntools.\n\n[2]: https://twitter.com/nrr/status/529016501421240322\n\n\n## Dependencies\n\nodo depends on atomic compare-and-swap functionality (e.g.\n`__sync_bool_compare_and_swap`), which is available on most common\nplatforms. The build is currently tested on Linux, OpenBSD, and OSX on\nx86 and x86-64 systems, as well as on a Raspberry Pi (32-bit ARM).\n\nIf the gcc-specific feature defines in `types.h` are not recognized by\nyour C99 compiler, you may need to set `COUNTER_SIZE` in the Makefile\nyourself: `-DCOUNTER_SIZE=4` for 32-bit systems and `-DCOUNTER_SIZE=8`\nfor 64-bit systems.\n\n\n## Getting started\n\nTo build it, just type:\n\n    $ make\n\nTo install it:\n\n    $ make install\n\nTo run the tests:\n\n    $ make test\n\n\n## Example Use\n\nThis atomically increments a counter in /log/restarts. If the counter\nfile does not exist, it is created as 0 and incremented to 1.\n\n    $ odo /log/restarts\n    \nSame, but print the updated count:\n\n    $ odo -p /log/restarts\n    \nReset the count to 0:\n\n    $ odo -r /log/restarts\n    \nSet the count to a number (for testing notifications, perhaps):\n\n    $ odo -s 12345 /log/restarts\n\nPrint the current counter value without incrementing:\n\n    $ odo -c /log/restarts\n\nPrint usage / help:\n\n    $ odo -h\n\n\n## Note\n\nodo's atomicity is only as reliable as the underlying filesystem's.\nInconsistencies may still occur if used on a non-local filesystems\nsuch as nfs.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatomicobject%2Fodo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatomicobject%2Fodo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatomicobject%2Fodo/lists"}