Backup on S3 Amazon


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Backup on S3 Amazon
# 1  
Old 01-20-2015
Backup on S3 Amazon

Hi,

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

Last edited by Don Cragun; 01-20-2015 at 03:54 AM.. Reason: Add CODE tags again.
# 2  
Old 01-20-2015
Quote:
Originally Posted by chetan
Hi,

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).
Login or Register to Ask a Question

Previous Thread | Next Thread

3 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

rsync backup mode(--backup) Are there any options to remove backup folders on successful deployment?

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)
Discussion started by: MVEERA
0 Replies

2. Solaris

Amazon S3 storage mounting.

We need to mount an amazon S3 share on windows as well as Solaris servers. Any help is appreciated. Thanks in advance. (5 Replies)
Discussion started by: uxadmin007
5 Replies

3. Virtualization and Cloud Computing

CEP as a Service (CEPaaS) with MapReduce on Amazon EC2 and Amazon S3

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)
Discussion started by: Linux Bot
0 Replies
Login or Register to Ask a Question