Chapter 16: Shell Script Examples for Server Management, Network Configuration, and Backups
Now that we've covered everything that we wanted to cover in terms of various concepts and structures in Bash shell scripting, let's dig into some examples. This will allow us to put these last few chapters to good use as shell scripts are the most commonly used tools in system engineers' daily jobs. Due to this, we are going to go through some shell scripts to emphasize the point of scripting – to make our lives a lot easier.
In this chapter, we're going to cover the following recipes:
- Creating a file and folder inventory
- Checking if you're running as root
- Displaying server stats
- Finding files by name, ownership, or content type and copying them to a specified directory
- Parsing date and time data
- Configuring the most common firewall settings interactively (
firewalld
andufw
) - Configuring network settings interactively (
nmcli
...