Tag : bash

Piping psql into jq

The modern hero of shell scripts is jq. Pipe in JSON, find values, store back into variables or create new JSON and work with that. Unfortunately my data was in PostgreSQL, and the psql output is not JSON. But it would be awesome if it was. Just imagine the power of psql -c ‘SELECT somecolumn

Dr Nic Williams Profile Image

Posted by:
Dr Nic Williams

Read More ➝
My Shell, My Bell: While/Xargs by Example

Earlier today I logged into a jumpbox session and was greeted with some lovely error messages: $ channel 12: open failed: administratively prohibited: open failed channel 13: open failed: administratively prohibited: open failed channel 19: open failed: administratively prohibited: open failed channel 20: open failed: administratively prohibited: open failed channel 21: open failed: administratively prohibited:

Quintessence Anx Profile Image

Posted by:
Quintessence Anx

Read More ➝
How to download the latest release from Github

GitHub Releases are a great resource for open source projects to expand on the simple git tag concept. You can add release notes in Markdown format, and you can upload finalized assets – such as compiled executables. As a user I had the question – how do I script "download the latest release, please?" For

Dr Nic Williams Profile Image

Posted by:
Dr Nic Williams

Read More ➝
Wait until SSH is available

Ever run into a situation where you need to ssh into a newly created server but you aren’t sure that the server is listening on the ssh port yet? For the Terraform OpenStack install of Cloud Foundry the Bastion server isn’t immediately available for the provision script to run. Below is a short bash script

Chris Weibel Profile Image

Posted by:
Chris Weibel

Read More ➝
Inspecting BOSH manifests in Bash

As mentioned yesterday, BOSH manifests can be huge – 3000 lines of YAML for deploying Cloud Foundry into bosh-lite for example. I wanted to quickly pull out information from a manifest. yaml2json This little CLI will convert YAML to JSON. go get github.com/bronze1man/yaml2json We can pipe any BOSH deployment manifest into it and out comes

Dr Nic Williams Profile Image

Posted by:
Dr Nic Williams

Read More ➝
Admin scripting your way around Cloud Foundry

Cloud Foundry has a lightning fast CLI written in Go, a very well documented API https://apidocs.cloudfoundry.org/, and the API endpoints return consistently structured data. It is ripe for automation. But can we do it with just some bash scripts like sysadmins of old? Oh yes indeed. You too can write bash scripts that do magical

Dr Nic Williams Profile Image

Posted by:
Dr Nic Williams

Read More ➝