Shell Scripts and Automation
In the previous chapter, we looked in detail at filesystem cleanup, exploring the pacman cache, uninstallation, and cleaning tool approaches. We then briefly covered the topic of defragmentation. After that, we moved on to system information extraction with inxi, along with a practical example of troubleshooting. We finished the chapter with easy instructions on reinstalling and keeping our original home partition.
In this chapter, we will continue with the basics of BASH shell scripts. They can execute any commands automatically, including those for system administration. We will explore their syntax, basic rules, and where to get more information and examples. We will then review the setup of periodic and calendar-based execution of commands and scripts, based on cron jobs and systemd timers. We will close the chapter by revealing how systemd timers can execute tasks related to system events for us.
The sections in this chapter are as follows:
...