Devops? Dev workflows? I'm curious what people are doing with those

We're a place where coders share, stay up-to-date and grow their careers.
Devops? Dev workflows? I'm curious what people are doing with those
Jalal Uddin -
Madza -
dev.to staff -
Sharad Raj (He/Him) -
Discussion
Anything sysadmin related that does not warrant more complex automation such as a Python script or Ansible playbook.
Shell scripts are really powerful if used right. A simple example that’s part of the sysadmin scripts I use myself would be:
This is actually POSIX compliant Bourne shell, not bash, but that’s kind of irrelevant to my point here. The script itself handles updating Alpine Linux based Docker containers built locally if their parent image has been updated or the packages they include have updates in the Alpine repositories. It’s part of the tooling I use with the various Docker Compose projects I have set up on personal systems, as I have a lot of local custom containers based on Alpine Linux that I want to keep up to date while avoiding needless rebuilds. It mostly gets called by a different script that orchestrates the proper order of
docker pull
,docker build
, anddocker-compose up -d
commands to do a coherent update of said Docker Compose projects while minimizing overall downtime.That's pretty great
Mostly wrappers around other commands. Got one for
apt
mostly to "rename" some commands (I'm looking at youapt purge
), one forxdotool
to move the mouse, one fordeno
, a "powermenu", a calculator thingy usingbc
.I use shell scripts way more than I probably should. For example I smacked together a simple site generator with Bash (with Node/Commonmark.js to convert MD to HTML) the other day. If I were to write something for the general public I would likely have used something like Node, Python or Go, but being aware of the limitations and being able to avoid edge cases as the only user it does its job perfectly well.
You've got to make an article about it, this is so cool
The Linux distro I use uses a package manager written in POSIX sh
github.com/kisslinux/kiss
I have a power management utility written in POSIX sh
git.sr.ht/~fultonbrowne/fpm
The tool called shellcheck can be used to check to POSIX compliance of your scripts
github.com/koalaman/shellcheck
My rule is that if the bash script is more than three lines long, it should be rewritten in $YOUR_FAVORITE_LANGUAGE instead of a hack like Bash where you have to google up every time basic things like "How do I do a for loop?"
I do a fair amount of quasi-prototyping using shells, since it's trivial to take repetitious command-line tasks and turn them into a script. I say "quasi," because a lot of the scripts are fine as-is, so I don't convert them to a more typical programming language.
The scripts I currently use regularly are...
I also have a bunch of scripts that coordinate a bunch of small programs, like when I generate my monthly newsletter, since each component is independent (so I don't want them in a combined program, since that's not modular) and it's not worth writing something more complex than "call these in succession and dump the output to the same file before sending it to MailChimp."
Occasionally, something graduates to a (depending on my mood) Ruby or Node script, when the shell code becomes hard to maintain and I need to maintain it, but a lot of it also just stays as-is.
Ok now I'm impressed!
Init scripts. That’s all.
Exactly what you wrote, DevOps + Dev workflows (pipelines)
Generating static sites mkws.sh. 😜
There is a lot of shell scripting in Sparrow plugins - sparrowhub.io