{"id":18544067,"url":"https://github.com/swagdevops/sv-utils","last_synced_at":"2026-04-25T12:34:39.342Z","repository":{"id":54623644,"uuid":"141846107","full_name":"SwagDevOps/sv-utils","owner":"SwagDevOps","description":"Runit (sv) utils","archived":false,"fork":false,"pushed_at":"2024-05-16T18:57:56.000Z","size":180,"stargazers_count":1,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-17T09:15:11.197Z","etag":null,"topics":["alpine","alpine-linux","docker","runit","services"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SwagDevOps.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-21T21:09:43.000Z","updated_at":"2021-05-21T16:55:10.000Z","dependencies_parsed_at":"2024-12-26T06:20:02.019Z","dependency_job_id":null,"html_url":"https://github.com/SwagDevOps/sv-utils","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwagDevOps%2Fsv-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwagDevOps%2Fsv-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwagDevOps%2Fsv-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwagDevOps%2Fsv-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SwagDevOps","download_url":"https://codeload.github.com/SwagDevOps/sv-utils/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254281755,"owners_count":22045015,"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":["alpine","alpine-linux","docker","runit","services"],"created_at":"2024-11-06T20:15:17.748Z","updated_at":"2026-04-25T12:34:34.306Z","avatar_url":"https://github.com/SwagDevOps.png","language":"Ruby","readme":"# Sv Utils\n\n## ``svrun`` - avoid skeleton service burden\n\nAccording to the [``runit-scripts``][runit-scripts]\n([tarball][runit-scripts-tarball])\na minimal skeleton service (using [Alpine Linux][alpine-linux]) looks like:\n\n```sh\n#!/usr/bin/env sh\n# /etc/sv/skeleton/run\nset -eu\n\nexec 2\u003e\u00261\n\nCOMMAND=daemon\nUSER=root\n\nexec /usr/bin/chpst -u ${USER} ${COMMAND}\n```\n\nSee also:\n\n* [Does runit support user-specific services?][runit-doc:userservices]\n\n```sh\n#!/usr/bin/env sh\n# /etc/sv/skeleton/log/run\nset -eu\n\nSERVICE_NAME=`basename $(dirname $(dirname $(readlink -f $0)))`\nLOG_DIR=/var/log/runit/${SERVICE_NAME}\nUSER=root\nGROUP=root\n\n# Create log dir and fix owner \u0026 mode\nmkdir -p ${LOG_DIR}\nchown ${USER}:${GROUP} ${LOG_DIR}\nchmod 700 ${LOG_DIR}\n\nexec /usr/bin/chpst -u ${USER} /usr/bin/svlogd -tt ${LOG_DIR}\n```\n\nUsing ``sv-utils``:\n\n```ruby\n#!/usr/bin/env svrun\n\nservice('daemon').call\n```\n\n```ruby\n#!/usr/bin/env svrun\n\nloggerd.call\n```\n\nMoreover, options as ``:user`` and ``:group`` are supported\nby ``loggerd`` and ``service`` methods, as:\n\n```ruby\nservice('daemon', user: :john_doe).call\n```\n\n``:command``, defined in config for ``loggerd``, is used by default,\nbut it can be overriden (for example using [socklog][socklog]):\n\n```ruby\n#!/usr/bin/env svrun\n\nloggerd(['svlogd', '-t', 'main/*'], user: :log).call\n```\n\nLog directory is created, under the hood, during ``loggerd`` call.\n\n``sv-utils`` is an attempt to bring [DRY principle][dry-definition]\nto ``runit`` services creation.\n\n## See also\n\n* [UNIX Programming by Example: Runit][sa:unix-programming-by-example-runit]\n\n[alpine-linux]: https://alpinelinux.org/\n[runit-scripts]: https://github.com/dockage/runit-scripts\n[runit-scripts-tarball]: https://api.github.com/repos/dockage/runit-scripts/tarball\n[socklog]: http://smarden.org/socklog/\n[dry-definition]: https://en.wikipedia.org/wiki/Don%27t_repeat_yourself\n[runit-doc:userservices]: http://smarden.org/runit/faq.html#userservices\n[sa:unix-programming-by-example-runit]: http://tammersaleh.com/posts/unix-programming-by-example-runit/\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswagdevops%2Fsv-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswagdevops%2Fsv-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswagdevops%2Fsv-utils/lists"}