Bash scripts simplify server interaction and automate processes.
The core of scripts
A standard bash script starts with the line:
In order for the script to be executed, it must be made executable:
chmod + x filename .sh
Some commands require adding rules to the sudoers file.
For the script to be executed automatically, you need to specify it in the cron file.
Location of scripts
Scripts can be placed in the system directory:
However, I prefer to put my scripts separately in the user directory for easy backup. For instance: