Operating System - HP-UX
1754017 Members
7698 Online
108811 Solutions
New Discussion юеВ

Re: Backups on weekly basis

 
SOLVED
Go to solution
musaddaq_2
Frequent Advisor

Backups on weekly basis

Hi
I am looking forward to create a script where system should sugest me the tape number.
For eg I have 12 tapes .

1) Saturday to Wednesday = 5 tapes (TNO1 to TNO5)
2) Weekly backup tape = 1st Thursday(TNO6)
3) 2nd Saturday to 2nd Wednesday = 5 tapes(TNO7 to TNO11)
4)Weekly backup tape = 2nd Thursday(TNO12)

and backup to step 1

I Guess it can be done on weeks count
Like We have 52 weeks

1st week it should ask me
Saturday to Wednesday = 5 tapes (TNO1 to TNO5)

and 2nd week
2nd Saturday to 2nd Wednesday = 5 tapes(TNO7 to TNO11)

With EVEN and ODD combination

But i dont know how best i can write it in script.

Regards

Musaddaq





6 REPLIES 6
Yogeeraj_1
Honored Contributor

Re: Backups on weekly basis

hi Musaddaq,

did you have a look at Data Protector?

this software make these tasks simple for you.

hope this helps
kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Raj D.
Honored Contributor

Re: Backups on weekly basis

Hi Musaddaq ,

Dataprotector:
A scalable data management solution that automates high performance backup and recovery, from disk or tape, over unlimited distances, ensuring 24x7 business operations and maximized IT resources.

You can check this page for details:

http://h18006.www1.hp.com/products/storage/software/dataprotector/


Cheers,
Raj.


" If u think u can , If u think u cannot , - You are always Right . "
Chan 007
Honored Contributor
Solution

Re: Backups on weekly basis

Hi,

A script can be written,

all you have to do it to check a file.

E.g

DAT.NUM will be increamented each time

The File DAT.NUM will have just
DAT01

once that backup is complete it will be
DAT02

ensure that your scripts changes each time and at 12th run puts to DAT01.

Else use dataprotector

007
James R. Ferguson
Acclaimed Contributor

Re: Backups on weekly basis

Hi:

Here's a simple perl script. You can adapt it to your rules as needed. The script returns a three-item string denoting the day-of-the-week (1-7 where 1=Monday), the number of the week within the month (1-5) and the week-number (1-53) of the year.

#!/usr/bin/perl
use strict;
use warnings;
use Date::Calc qw( Decode_Date_US Day_of_Week Week_of_Year );
die "Usage: $0 MMDDYYYY\n" unless @ARGV;
my ($year, $month, $day);
if (($year, $month, $day) = Decode_Date_US($ARGV[0])) {
print Day_of_Week ($year, $month, $day), " ",
int (($day + Day_of_Week ($year, $month, 1) - 2) / 7) + 1, " ",
scalar Week_of_Year($year, $month, $day), "\n";
}
1;

Run the script by passing a US-format (MMDDYYYY) date either with or without delimiters:

# ./daynums 01/01/2005
6 1 53

...since 01/01/2005 was a Saturday (6) in the first (1) week of January but is reckoned as the LAST (53rd) week of the preceeding year, since no Monday had yet occured in 2005.

# ./daynums 12/28/2005
3 5 52

...a Wednesday (day-3) of the fifth (5) week of the month and the 52nd week of the year.

If you would prefer to work and think in European rathter than US formats, substitute "_EU" for "_US" and change the line beginning with "die" thusly:

use Date::Calc qw( Decode_Date_EU Day_of_Week Week_of_Year );
die "Usage: $0 DDMMYYYY\n" unless @ARGV;
my ($year, $month, $day);
if (($year, $month, $day) = Decode_Date_EU($ARGV[0])) {

Then for December 28, 2005 you would do:

# ./daynums 28/12/2005
3 5 52

Regards!

...JRF...
musaddaq_2
Frequent Advisor

Re: Backups on weekly basis

Thnaks A lot Guys
I will try making the script from your suggestions and will get back to you.

Regards

Musaddaq
Muthukumar_5
Honored Contributor

Re: Backups on weekly basis

You can select device number with this script as,

# cat device.sh
#!/bin/sh

if [[ `expr $(date +'%W') % 2` -ne 0 ]]
then
if [[ $(date +'%a') = "Sat" ]]
then
echo "Tape Device = TN01"
elif [[ $(date +'%a') = "Sun" ]]
then
echo "Tape Device = TN02"
elif [[ $(date +'%a') = "Mon" ]]
then
echo "Tape Device = TN03"
elif [[ $(date +'%a') = "Tue" ]]
then
echo "Tape Device = TN04"
elif [[ $(date +'%a') = "Wed" ]]
then
echo "Tape Device = TN05"
elif [[ $(date +'%a') = "Thu" ]]
then
echo "Tape Device = TN06"
fi
else
if [[ $(date +'%a') = "Sat" ]]
then
echo "Tape Device = TN07"
elif [[ $(date +'%a') = "Sun" ]]
then
echo "Tape Device = TN08"
elif [[ $(date +'%a') = "Mon" ]]
then
echo "Tape Device = TN09"
elif [[ $(date +'%a') = "Tue" ]]
then
echo "Tape Device = TN10"
elif [[ $(date +'%a') = "Wed" ]]
then
echo "Tape Device = TN11"
elif [[ $(date +'%a') = "Thu" ]]
then
echo "Tape Device = TN12"
fi
fi


# END
exit 0

########################

If you execute this every day, it will work based on date command.

-Muthu
Easy to suggest when don't know about the problem!