Five Bash Scripts Every DevOps Must Know
Briefly

Bash is crucial in DevOps roles for tasks such as networking, VPN setup, disk partitioning, and server management. Despite the use of Ansible for automation, Bash provides incredibly flexible solutions for specific tasks, such as adding users or filtering log files. Essential Bash scripts can simplify actions, like securely backing up user directories using commands that involve variables and directory management. Key scripts can be written concisely, demonstrating the power of Bash for everyday DevOps management tasks.
When someone asks to be added to a group, will you write a role or playbook for that? No. Or for tasks like filtering /var/log, Bash is your best friend-not Ansible.
We start with variables. Timestamp based on date, SOURCE_DIR, and DEST_DIR where we’re copying to. Just tell Bash to call it /backup so we know in a few months what this folder is.
With Bash, we can clear it in a few lines, really. Backup of $SOURCE_DIR completed at $DEST_DIR/home_backup_$TIMESTAMP.tar.gz
Read at Medium
[
|
]