top | item 35124088

(no title)

p4l4g4 | 3 years ago

I work at a database heavy company as an infra engineer. From time to time we get requests from devs or customer success to run a query on all customer databases to see or certain assertions hold (e.g. If the latest update fixed a problem or estimate the impact of a change).

To automate this process, we have some ansible playbook to automate most of it: give it a query and you'll get a bunch of files with the results.

While useful, the setup and cleanup can get tidious. So, I whipped up a little shell script that creates a temporary directory and symlink it to a location somewhere in $XDG_STATE_HOME. I created a few subcommands to create the directory structure, add a query, run the query, aggregate results and destroy the state. This keeps things simple for me. Even if I forget to cleanup after myself, a reboot will make sure nothing is left behind. The symlink trick to xdg state home helps me a lot to track my state, while I work on a certain problem. It allows me to easily handle multiple request at the same time, when necessary.

discuss

order

No comments yet.