The weekly_backup_report.sh
script is a versatile tool designed for performing various system-related tasks on a weekly basis. Authored by Nwosu David, the script facilitates weekly backups, system metrics reporting, Oracle schema backup, and concludes by emailing a final report summarizing all activities.
To execute the script, run the following command:
./weekly_backup_report.sh [email protected]
Before utilizing the script, configure a cron job to automate its execution weekly. Follow these steps:
-
Copy the current crontab to a temporary file:
crontab -l > /tmp/temp_crontab
-
Append the cron job to the temporary file to run the script at 2 am every Sunday:
echo "0 2 * * 0 $HOME/weekly_backup_report.sh" >> /tmp/temp_crontab
-
Apply the changes to your crontab:
crontab /tmp/temp_crontab
-
Remove the temporary file:
rm /tmp/temp_crontab
- Creates backups of important files in
~/ingrydDocs
to a regular backup destination. - Compresses backups and skips the process if files have not changed since the last backup.
- Generates tabular reports on key system metrics including CPU usage, memory usage, disk space, and network statistics.
- Utilizes sysstat logs from
/var/log/sysstat
covering the past week.
- Backs up a specified Oracle schema to a remote destination using Data Pump Export.
- Transfers the backup file to the remote destination via SCP.
- Combines all reports into a final summary.
- Emails the final report to your email.
- Configure Oracle schema details, remote destinations, and email recipients in the script.
- Adjust the cron job timing according to your preference.
-
The script relies on the
sysstat
package for system metrics reporting. Ensure it is installed on your system:sudo apt-get install sysstat -y
-
The script uses
mutt
for email functionality. Install it using:sudo apt-get install mutt -y
-
Don't forget to add the mutt configuration in muttrc and source the file
- The script may require adjustments based on specific system configurations and preferences.
- Ensure the script is executed with the necessary permissions.