{"id":21869775,"url":"https://github.com/cha87de/bashutil","last_synced_at":"2026-05-19T15:08:18.801Z","repository":{"id":144742846,"uuid":"94689908","full_name":"cha87de/bashutil","owner":"cha87de","description":"bpkg package with utility functions: log, retry, trim, bgo and bgowait to manage background services","archived":false,"fork":false,"pushed_at":"2018-05-23T11:28:34.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-01-26T16:44:44.118Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","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/cha87de.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":"2017-06-18T13:46:14.000Z","updated_at":"2019-06-27T02:39:26.000Z","dependencies_parsed_at":"2023-04-26T18:00:30.725Z","dependency_job_id":null,"html_url":"https://github.com/cha87de/bashutil","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/cha87de%2Fbashutil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cha87de%2Fbashutil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cha87de%2Fbashutil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cha87de%2Fbashutil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cha87de","download_url":"https://codeload.github.com/cha87de/bashutil/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244875045,"owners_count":20524591,"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":[],"created_at":"2024-11-28T06:09:11.612Z","updated_at":"2026-05-19T15:08:13.746Z","avatar_url":"https://github.com/cha87de.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# bashutil - a bpkg package for utility functions\n\nWriting bash scripts can be very boring, when recurring functions for logging, error messages, string parsing or similar utility tasks are needed. This package offers a set\nof utility functions you will need for any bash script you write.\n\nThis repository is meant to be a package for the [bpkg bash package manager](http://www.bpkg.sh/).\n\n\n## Installation\n\n 1. Clone this repository and source the files directly, or\n 2. Use the bpkg bash package manager: `bpkg install cha87de/bashutil -g`\n\nTo install bpkg, run `curl -sLo- http://get.bpkg.sh | bash`.\n\n## Usage\n\n\n### bgo \u0026 bgowait\n\nThe tools bgo and bgowait allow to start a group of processes and wait for them. Example usage:\n\n```\n#!/bin/bash\nsource lib/bgo.sh\nsource lib/bgowait.sh\n\nfunction sleeper(){\n    sleep 50\n    return 0\n}\nfunction timer(){\n    sleep 1\n    date\n    return 0\n}\n\n# start\n\nbgo sleeper timer\n\n# wait\n\n#freq=5; waitForN=-1; killTasks=0 # fail one, ignore (e.g. development mode)\nfreq=5; waitForN=1; killTasks=1 #fail one, fail all (e.g. production mode)\nbgowait $freq $waitForN $killTasks\n```\n\nThe option `--waitgroup` allows to run more than one bgo \u0026 bgowait pair in parallel, with a different set of processes to wait for. If no wait group is specified, bgowait assumes all processes started with bgo - **system wide**.\nExample usage with wait groups:\n\n```\n#!/bin/bash\nsource lib/bgo.sh\nsource lib/bgowait.sh\n\nfunction sleeper(){\n    sleep 50\n    return 0\n}\nfunction timer(){\n    sleep 1\n    date\n    return 0\n}\n\n# start\n\nbgo -g group1 sleeper timer\nbgo -g group2 timer\n\n# wait\n\nfreq=5; waitForN=-1; killTasks=0 # fail one, ignore\nbgowait -g group1 $freq $waitForN $killTasks\n\nfreq=5; waitForN=1; killTasks=1 #fail one, fail all\nbgowait -g group2 $freq $waitForN $killTasks\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcha87de%2Fbashutil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcha87de%2Fbashutil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcha87de%2Fbashutil/lists"}