{"id":15288754,"url":"https://github.com/senotrusov/workety","last_synced_at":"2025-10-07T03:30:45.118Z","repository":{"id":619333,"uuid":"258485","full_name":"senotrusov/workety","owner":"senotrusov","description":"A library to run Ruby classes as daemons. Process start, signal handling, logfile/pidfile, restart by watchdog, exception handling, reporting to Airbrake and Exceptional, Rails environment load, mutithreaded workers.","archived":true,"fork":false,"pushed_at":"2017-04-23T20:00:57.000Z","size":139,"stargazers_count":5,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-01T12:00:03.318Z","etag":null,"topics":["daemon","error-reporting","exception-handling","logging","multithreading","pidfile","process","rails","ruby","watchdog"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"mozilla-services/Heartbleed","license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/senotrusov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-07-23T07:24:29.000Z","updated_at":"2025-04-01T11:32:25.000Z","dependencies_parsed_at":"2022-07-07T15:40:48.172Z","dependency_job_id":null,"html_url":"https://github.com/senotrusov/workety","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/senotrusov/workety","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/senotrusov%2Fworkety","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/senotrusov%2Fworkety/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/senotrusov%2Fworkety/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/senotrusov%2Fworkety/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/senotrusov","download_url":"https://codeload.github.com/senotrusov/workety/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/senotrusov%2Fworkety/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278715508,"owners_count":26033296,"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-07T02:00:06.786Z","response_time":59,"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":["daemon","error-reporting","exception-handling","logging","multithreading","pidfile","process","rails","ruby","watchdog"],"created_at":"2024-09-30T15:53:05.240Z","updated_at":"2025-10-07T03:30:44.853Z","avatar_url":"https://github.com/senotrusov.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Workety\n\nA library to run Ruby classes as daemons.\n\n* process start\n* terminal detach\n* run as a user/group (root privileges drop)\n* signal handling\n* logfile\n* pidfile, check for already running daemon\n* may restart in a case of failure, by forking from watchdog\n* may send exceptions to Airbrake and Exceptional\n* Rails environment load at a late stage\n* support for mutithreaded workers\n* command-line argument parsing by use of the [trollop](http://trollop.rubyforge.org) library\n* simple API for an application code\n\n\n### Command-line invocation\n\n```sh\n# run a daemon\nworkety -e development start Workety::SimpleThread --foo=bar\n#                      ^^^^^ Start as a daemon\n#       ^^^^^^^^^^^^^^ Options for Workety         ^^^^^^^^^ Options for the class\n\n# run a thread in the console\nworkety Workety::SimpleThread\n```\n\n### SimpleThread example\n\n```ruby\nclass SimpleThread\n  # Before dropping privileges\n  def initialize\n  end\n\n  # After changing privileges to some user/group\n  def start\n    @t = Thread.workety do\n      until Workety.must_stop? do\n        sleep 1\n      end\n    end\n\n    Thread.workety do\n      sleep 10\n      Workety.stop\n    end\n  end\n\n  def join\n    @t.join\n  end\n\n  def stop\n    @t.kill\n  end\nend\n```\n\n### GracefulStopThread example\n\n```ruby\nclass GracefulStopThread\n  # Before dropping privileges\n  def initialize\n    @mutex = Mutex.new\n    @wakeup = ConditionVariable.new\n  end\n\n  # After changing privileges to some user/group\n  def start\n    @worker = Thread.workety do\n      @mutex.synchronize do\n        until Workety.must_stop? do\n\n          puts \"Hello\"\n\n          @wakeup.wait(@mutex, 10)\n        end\n      end\n    end\n  end\n\n  def join\n    @worker.join\n  end\n\n  def stop\n    @mutex.synchronize do\n      @wakeup.signal\n    end\n  end\nend\n```\n\n\n## Copyright and License\n\n```\nCopyright 2006-2011 Stanislav Senotrusov\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n\n## Contributing\n\nPlease see our [Contributing Guidelines](CONTRIBUTING.md) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsenotrusov%2Fworkety","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsenotrusov%2Fworkety","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsenotrusov%2Fworkety/lists"}