Apparently process checking is critical. Yes, we already have tons of linux tools and tips available. Getting familiar with your weapons is actually the first step, and the easiest part.
More importantly, what questions you ask, what for, when approaching your critical process. Fortunately even with plain common sense, we can dig out lots of valuable information.
In bash scripting, it’s a good practice to exit for any unexpected/unhandled errors. Usually I enforce this by ‘bash -e myscript.sh‘. Today just got a surprise with ‘bash -e‘.
Check out below simple test. You might get bitten by this as well.
Ever need to check the output of shell functions/scripts? If no fatal/error messages found, resume normal procedure. Otherwise, go to error handling.
Usually people solve this, by redirecting stdout/stderr to grep command. But What About Time-consuming Functions/Scripts? Say several minutes. During this period, end users are blinded with nothing printed. It could be confusing and scaring to them.
Shell scripting is a must-have skill for DevOps. I used to be very very confident at Shell. But when I first tried ShellCheck, I realized that I’m just too proud and arrogant.
ShellCheck is a powerful code analysis tool for shell scripts. Like Pylint for Python or Rubocop for Ruby. Give it a try! You’ll get surprised.
Commands for Linux Package Management. e.g. apt-get, HomeBrew, Port