How to write idempotent Bash scripts · Fatih Arslan


112 bookmarks. First posted by reinhard_codes 13 days ago.


Good software is always written in an idempotent way, especially if you’re working in distributed systems, where operations might be eventually consistency and you might end up calling functions multiple times because of duplicate requests (such as in queues with At-Least-Once delivery guarantee). To make it idempotent you check if the file exists via the -f flag of the inbuilt test property of the shell: Another benefit is, you can easily upgrade the binary
to a new version by just removing it from your system, update the OP_VERSION env and re-run your script. Some of these
idioms are very specific (such as mounting or formatting), but as we saw,
creating idempotent and resilient software is always beneficial in the long
term. I know that I could use more sophisticated tools to provision a VM from
scratch, but sometimes a simple bash script is the only thing you need.
7 days ago by sechilds
This blog post shows tips and tricks to write resilient and idempotent bash scripts.
bash  shell  best-practices 
7 days ago by vipom
Let me show a couple of bash tips and idioms you can use to change your scripts to be idempotent. You’re probably using most of them without being aware of the side effects
bash  linux  shell 
9 days ago by whip_lash
How to write idempotent Bash scripts · Fatih Arslan
from twitter
9 days ago by jpmayo
How to write idempotent Bash scripts July 3, 2019 Photo by Callum Wale on Unsplash It happens a lot, you write a bash script and half way it exits due an error.…
from instapaper
9 days ago by michaelfox
It happens a lot, you write a bash script and half way it exits due an error. You fix the error in your system and run the script again. But half of the steps in your scripts fail immediately because they were already applied to your system. To build resilient systems you need to write software that is idempotent.
bash  linux  shell 
9 days ago by Tafkas
It happens a lot, you write a bash script and half way it exits due an error. You fix the error in your system and run the script again. But half of the steps in your scripts fail immediately because they were already applied to your system. To build resilient systems you need to write software that is idempotent.
linux 
9 days ago by prcleary
It happens a lot, you write a bash script and half way it exits due an error. You fix the error in your system and run the script again. But half of the steps in your scripts fail immediately because they were already applied to your system. via Pocket
IFTTT  Pocket  refind  s 
9 days ago by igorette
It happens a lot, you write a bash script and half way it exits due an error. You fix the error in your system and run the script again. But half of the steps in your scripts fail immediately because they were already applied to your system. How to write idempotent Bash scripts · Fatih Arslan
Archive  best  stories  hacker  news 
9 days ago by Agiza
Tips on how to modify bash commands to make them idempotent.
programming  bash 
10 days ago by migreenberg
Love from @fatih

Perfect little cheat-sheet for the idempotent versions of the most commo…
linux  programming 
10 days ago by joho
How to write idempotent Bash scripts
from twitter_favs
10 days ago by mybeky