Writing shell filters for fun and profit

Why ? During my daily job I have sometimes to debug failed openqa test jobs. One of the testing mantra is to reproduce the issue and for that task the openqa community has developed some tooling. In practice, I often have some output like this one below from some job cloning operations: Cloning parents of sle-15-SP4-Server-DVD-Updates-x86_64-Build20250112-1-fips_ker_mode_gnome@64bit 1 job has been created: - sle-15-SP4-Server-DVD-Updates-x86_64-Build20250112-1-fips_ker_mode_gnome@64bit -> https://openqa.suse.de/tests/16425390 Cloning parents of sle-15-SP5-Server-DVD-Updates-x86_64-Build20250112-1-fips_ker_mode_gnome@64bit 1 job has been created: - sle-15-SP5-Server-DVD-Updates-x86_64-Build20250112-1-fips_ker_mode_gnome@64bit -> https://openqa.suse.de/tests/16425391 Cloning parents of sle-15-SP4-Server-DVD-Updates-x86_64-Build20250112-1-fips_ker_mode_gnome@64bit 1 job has been created: - sle-15-SP4-Server-DVD-Updates-x86_64-Build20250112-1-fips_ker_mode_gnome@64bit -> https://openqa.suse.de/tests/16425392 And when I want to monitor those jobs, I’d need to copy-paste all the job URLs and pass them as arguments to the cool openqa-mon utility which will show and notify me of the job status in the terminal. ...

January 19, 2025 · Andrea Manzini

generare comandi di creazione utenze a partire da un passwd

A volte e’ necessario replicare le utenze con gli stessi parametri su piu’ server linux diversi. Perche’ farlo a mano ? Se sono tanti e’ un lavoro noioso e potremmo anche commettere degli errori. Ecco un semplice one-liner che fa il parsing di un file /etc/passwd e genera i corrispondenti comandi useradd awk -F: '{printf "useradd -m -u%s -g%s -d%s -s%s %s\n" , $3,$4,$6,$7,$1}' /etc/passwd Ovviamente l’output puo’ essere comodamente filtrato con grep, usato via copy&paste, inserito in uno script, eccetera… ...

November 23, 2012 · Andrea Manzini