Can someone help me how can I made when backup is done to send me email?
I'm using bash for first time and I'm not sure what I doing.
We have made the script to take the backup of server locally and on S3 Amazon..I am checking this backup manually. I need the script which calculate the size of the .tar.gz.
It means the scripts need to send me the notification that Backup on S3 for date so and so has been complateted and the size of the backup file is 3 GB..like this
I am using below script at the end of the my orignal script .
Code:
#!/bin/bash
DATE=`date +%Y-%m-%d`
NOW=$(date +"%Y-%m-%d-%H%M")
FILE1=$(du -ks $Server Path | awk '{print $1}') # get file size in K
echo "Sending Backup report : Backup of $DATE.tar.gz completed and Size is $FILE1" | mail -s " Server Backup report " abx@gmail.com
Can you please help me?
1. How to calcualte the size of the backup file on s3?
2. Send notification also
The Server variable is not defined in this script, and there doesn't seem to be a file named Path, so there isn't likely to be any output written to standard output from the command:
Code:
du -ks $Server Path
but a diagnostic message similar to:
Code:
du: Path: No such file or directory
is likely to be written to the standard error output.
If you want the size of the file named by the expansion of $DATE.tar.gz , you probably want something more like:
Code:
FILE1=$(du -ks "$DATE.tar.gz" | awk '{print $1}') # get file size in K
or
FILE1=$(ls -l "$DATE.tar.gz" | awk '{printf("%.0f\n", $5 / 1024}') # get file size in K
assuming that ls -l on your system prints the file's size as the 5th field (as specified by the standard).
Tim Bass
11-25-2008 01:02 PM
Just as I was starting to worry that complex event processing community has been captured by RDBMS pirates off the coast of Somalia, I rediscovered a new core blackboard architecture component, Hadoop.
Hadoop is a framework for building applications on large... (0 Replies)
Hi Everyone,
we are running rsync with --backup mode, Are there any rsync options to remove backup folders on successful deployment?
Thanks in adv. (0 Replies)