3 ms·
I use Bash in an idempotent fashion so that my readers can rerun the demonstrations of Deployment from Scratch (or even just small part of them). Apart from do
by strzibny 5y ago
I use Bash in an idempotent fashion so that my readers can rerun the demonstrations of Deployment from Scratch (or even just small part of them).
Apart from doing what the article suggests, I make sure that every step of a process is rerunnable by cleaning the state beforehand.
E.g.
rm -rf /path/to/dir
mkdir -p /path/to/dir
# use the dir now
If a command doesn't have the right switch to handle both cases (like using semanage), I use || to fallback to another command.
It feels pretty manual compared to some declarative approach, but it works nicely in small Bash scripts.