Description
If you find that you have to repeat several commands in the same sequence day in a day out, you should consider Shell script. Shell scripts are used the same way as bath file in DOS and Windows to simplify the command.
Creating Shell Script
Creating Shell Script is as easy as note down your command sequence and type them in any text editor and save it on the hard drive.
Example:
I transferred my backup databases daily to a backup computer. I uncompressed it every day. So I created a script with a text editor and save it as unpack_database.script.
cd /
tar -xvf /home/ubuntu/databases.gz
From now on, I can run it with
sh unpack_database.script
to run the two commands above.
This script is not very complicated. However, you can build complicated script with several simple scripts. A complex script can dump databases into sql file, compress them, transfer the compressed file to another computer.
Eventually, you can run the tested scripts with crontab automatically.