snapshot_backup
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
snapshot_backup [2011/09/23 15:14] – [bash config] k2patel | snapshot_backup [2020/08/10 02:35] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 8: | Line 8: | ||
* perl | * perl | ||
* Net:: | * Net:: | ||
+ | * DBI:SQLite | ||
* bash | * bash | ||
Line 20: | Line 21: | ||
* delete_snap.pl | * delete_snap.pl | ||
- | ==== C0D3s ==== | + | ===== C0D3s ===== |
- | === config === | + | ==== config |
<code bash | config > | <code bash | config > | ||
Line 38: | Line 39: | ||
# instance< | # instance< | ||
- | #instance1=" | + | instance1=" |
- | #instance2=" | + | instance2=" |
</ | </ | ||
Line 123: | Line 124: | ||
##################################### | ##################################### | ||
- | source config_bash | ||
- | BASE=$(pwd) | ||
BASE=" | BASE=" | ||
cd $BASE | cd $BASE | ||
+ | |||
+ | source config_bash | ||
+ | |||
DATE=$(date +%Y%m%d) | DATE=$(date +%Y%m%d) | ||
perl=$(which perl) | perl=$(which perl) | ||
Line 225: | Line 227: | ||
#print Dumper \@result; | #print Dumper \@result; | ||
</ | </ | ||
+ | |||
+ | ==== delete shnapshot ==== | ||
+ | <code perl | delete_snap.pl> | ||
+ | # This script delete snapshot of requested volume | ||
+ | # Author : k2patel < | ||
+ | # Please send me message for suggestion or update. | ||
+ | |||
+ | # this script delete snapshot | ||
+ | |||
+ | use Data:: | ||
+ | use strict; | ||
+ | #use Date::Calc qw( :all ); | ||
+ | |||
+ | use lib "/ | ||
+ | use Net:: | ||
+ | |||
+ | # Configuration. | ||
+ | require " | ||
+ | |||
+ | # our $ec2; | ||
+ | our $awsId; | ||
+ | our $awsKey; | ||
+ | our $awsinstance; | ||
+ | |||
+ | my($num_args) = $#ARGV + 1; | ||
+ | if ($num_args < 1) { | ||
+ | print " | ||
+ | print "This will Delete Snapshot\n"; | ||
+ | exit 1; | ||
+ | } | ||
+ | |||
+ | ## Define Access Keys for Amazon. | ||
+ | my $ec2 = Net:: | ||
+ | AWSAccessKeyId => $awsId, | ||
+ | SecretAccessKey => $awsKey | ||
+ | ); | ||
+ | |||
+ | my @result = $ec2-> | ||
+ | SnapshotId => $ARGV[0] | ||
+ | ); | ||
+ | |||
+ | |||
+ | if ( $result[0] eq 1 ){ | ||
+ | #print "Good to go \n"; | ||
+ | exit 0; | ||
+ | }else{ | ||
+ | my $err = Dumper \@result; | ||
+ | open F,"> | ||
+ | print F $err; | ||
+ | close F; | ||
+ | if(system ("/ | ||
+ | unlink " | ||
+ | } | ||
+ | exit 1; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ==== Check Snapshot status ==== | ||
+ | <code perl | snap_status.pl > | ||
+ | # This script check status of given snapshot and wait for it get completed. | ||
+ | # Author : k2patel < | ||
+ | # Please send me message for suggestion or update. | ||
+ | |||
+ | |||
+ | use Data:: | ||
+ | use strict; | ||
+ | #use Date::Calc qw( :all ); | ||
+ | |||
+ | use lib "/ | ||
+ | use Net:: | ||
+ | |||
+ | # Configuration. | ||
+ | require " | ||
+ | |||
+ | # our $ec2; | ||
+ | our $awsId; | ||
+ | our $awsKey; | ||
+ | our $awsinstance; | ||
+ | |||
+ | my($num_args) = $#ARGV + 1; | ||
+ | if ($num_args < 1) { | ||
+ | print " | ||
+ | print "This will check Snapshot Status\n"; | ||
+ | exit 1; | ||
+ | } | ||
+ | |||
+ | ## Define Access Keys for Amazon. | ||
+ | my $ec2 = Net:: | ||
+ | AWSAccessKeyId => $awsId, | ||
+ | SecretAccessKey => $awsKey | ||
+ | ); | ||
+ | |||
+ | my @result = $ec2-> | ||
+ | SnapshotId => $ARGV[0] | ||
+ | ); | ||
+ | |||
+ | while ( $result[0][0]-> | ||
+ | sleep 10; | ||
+ | } | ||
+ | |||
+ | if ( $result[0][0]-> | ||
+ | my $tst = "Good to go \n"; | ||
+ | exit 0; | ||
+ | }else{ | ||
+ | my $err = Dumper \@result; | ||
+ | open F,"> | ||
+ | print F $err; | ||
+ | close F; | ||
+ | if(system ("/ | ||
+ | unlink " | ||
+ | } | ||
+ | exit 1; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | ==== Machine DB ==== | ||
+ | |||
+ | <code bash> | ||
+ | sqlite3 machine.db | ||
+ | </ | ||
+ | |||
+ | <code sql | machine.db> | ||
+ | PRAGMA foreign_keys=OFF; | ||
+ | BEGIN TRANSACTION; | ||
+ | CREATE TABLE DESK ( v_ID, s_ID, Dte ); | ||
+ | </ | ||
+ |
snapshot_backup.1316790883.txt.gz · Last modified: 2020/08/10 02:29 (external edit)