{"id":17798950,"url":"https://github.com/icy/rolo","last_synced_at":"2025-03-17T05:32:02.435Z","repository":{"id":3972180,"uuid":"5066932","full_name":"icy/rolo","owner":"icy","description":"Prevents a program from running more than one copy at a time ","archived":false,"fork":false,"pushed_at":"2023-11-29T15:23:57.000Z","size":36,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-27T18:13:00.136Z","etag":null,"topics":["cronjob","ruby","system"],"latest_commit_sha":null,"homepage":"http://rubygems.org/gems/rolo","language":"Ruby","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/icy.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":"2012-07-16T12:12:24.000Z","updated_at":"2023-11-29T15:24:00.000Z","dependencies_parsed_at":"2025-01-22T21:15:22.409Z","dependency_job_id":null,"html_url":"https://github.com/icy/rolo","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icy%2Frolo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icy%2Frolo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icy%2Frolo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/icy%2Frolo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/icy","download_url":"https://codeload.github.com/icy/rolo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243846976,"owners_count":20357294,"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":["cronjob","ruby","system"],"created_at":"2024-10-27T12:03:40.586Z","updated_at":"2025-03-17T05:32:02.152Z","avatar_url":"https://github.com/icy.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/icy/rolo.svg?branch=master)](https://travis-ci.org/icy/rolo)\n\n## NAME\n\n  `rolo` -- Prevents a program from running more than one copy at a time\n\n## SYNOPSIS\n\n    $0 [options] command [arguments]\n\n## DESCRIPTION\n\n  `robo(.rb)` is a `Ruby` version of Timothy program\n  \u003chttps://github.com/timkay/solo\u003e with some more options.\n\n  `rolo` starts an application and/or prevent it from running twice by simply\n  checking if there is a network socket that is open by the application\n  and/or by `rolo`.\n\n  `rolo` prevents a program from running more than one copy at a time;\n  it is useful with cron to make sure that a job doesn't run before a\n  previous one has finished.\n\n## OPTIONS\n\n  Please run the command `rolo` without any arguments for more details.\n\n## INSTALLATION\n\n  This program can be installed by using RubyGems\n\n    gem install --remote rolo\n\n  You can build and install it locally\n\n    git clone git://github.com/icy/rolo.git\n    cd rolo\n    gem build rolo.gemspec\n    gem install --local rolo-VERSION.gem\n\n## HOW IT WORKS\n\n  If the `--no-bind` option is used, the program will simply assume that\n  the port is open by another program and it will only check if that port\n  is open or not. Otherwise, see below.\n\n  Before starting your `\u003ccommand\u003e` (using `exec`), `rolo` will open a\n  socket on a local address (or address specified by option `--address`.)\n  This socket will be closed after your command exits, and as long as\n  your command is running, we have a chance to check its status by\n  checking the status of this socket. If it is still open when `rolo`\n  is invoked, `rolo` exits without invoking a new instance of command.\n\n  However, if your `\u003ccommand\u003e` closes all file descriptors at the time it\n  is executed, `rolo` will be sucked. (See `EXAMPLE` for details and for\n  a trick when using `rolo` with `ssh`.) If that the cases, you may\n  use the option `--address` and `--port` to specify a socket that your\n  command binds on.\n\n## EXAMPLE\n\n  Here are some simple examples and applications. Feel free to contribute.\n\n### Create SSH tunnels (OpenSSH older than 5.6p1)\n\n  To create tunnel to a remote server, you can use this ssh command\n\n    ssh -fN remote -L localhost:1234:localhost:10000\n\n  This allows you to connect to the local port 1234 on your mahince\n  as same as conneting to address `localhost:10000` on remote server.\n  The process `ssh` will go to background immediately after it authenticates\n  successfully with the remote.\n\n  To keep this tunnel persistent, you can add this to your crontab\n\n    rolo -p 4567 \\\n      ssh remote -fNL localhost:1234:localhost:10000\n\n  and allows this line to be executed once every 5 minutes. `rolo`\n  will check if your ssh command is still running. If 'yes', it will\n  simply exit; if 'no', `rolo` will start the ssh command.\n\n### With OpenSSH 5.6p1 or later\n\n  However, if you use *OpenSSH 5.6p1* (or later), `ssh` will close all file\n  descriptors from the parent (except for `STDIN`, `STDOUT` and `STDERR`).\n  As the socket opened by `rolo` is closed, `rolo` will always\n  start new instance of the `ssh` tunnel. (Actually I had process `bomb`\n  on my system when I used the original program `solo` to launch my\n  tunnels.)\n\n  Fortunately, `ssh` has option to bind on the local address.\n  Using this option we can trick `rolo` as below\n\n    rolo -p 4567 \\\n      ssh remote -fN \\\n        -L localhost:1234:localhost:10000 \\\n        -L %address:%port:localhost:12345\n\n  The last use of option `-L` will ask `ssh` to open a socket on\n  `%address:%port` (the real values will be provided by `rolo`),\n  and it will be checked by `rolo` in its next run. Please note that\n  we use a random port `12345` to prevent local connections to\n  `%address:%port` from being forwarded to remote.\n\n  Another way is to use option `--address`\n\n    rolo -p 1234 -a 127.0.0.1 \\\n      ssh remote -fNL localhost:1234:localhost:10000\n\n  And this is another way\n\n    rolo -p 1234 -a 127.0.0.1 \\\n      ssh remote -fNL %address:%port:localhost:10000\n\n  The following command creates a sock proxy\n\n    rolo -p 4444 -a 127.0.0.1 \\\n      ssh remote_ip -fN -D %address\n\n  and you can query your service via this proxy\n\n    curl api.ipify.org -L  --proxy socks5://127.0.0.1:4444/ ; echo\n\n### Create ssh tunnels: the cleanest way\n\n  Within the `--no-bind` option, you can event do something cleaner\n\n    rolo --no-bind -p 1234 -a 127.0.0.1 \\\n      ssh remote -fN -L localhost:1234:localhost:10000\n\n  Because `ssh` would listen on the local port `1234`, we may just ask\n  `rolo` to check if that port is open. If `yes`, it's sure that our\n  tunnel is running and `rolo` will simply exit. Otherwise, `ssh` may\n  exit and `rolo` will start new `ssh` tunnel.\n\n### Start VirtualBox guests\n\n  To make sure that your VirtualBox Windows guest is always running,\n  you can use:\n\n    rolo -a 1.2.3.4 -p 3389 --no-bind \\\n      VBoxManage startvm foobar --type headless\n\n  Here `1.2.3.4` is the guest's address, and `3389` is the port\n  that is used by `rdesktop` service on the guest.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficy%2Frolo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ficy%2Frolo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ficy%2Frolo/lists"}