1837090 Members
2247 Online
110112 Solutions
New Discussion

Re: Veritas Script

 
Ranjith_5
Honored Contributor

Veritas Script

Hi Experts,

I use veritas netbackup to backup my filesystems. I want to copy 10-15 policies in a new name with a change in storage unit ( Say STU_1) and I want to change the backup selections for that newly created policies.
My backup selections in the original policies starts with /snap. I want to remove the string snap from the backup selection and modify that to /xyz.

I want to copy all the policies where backup selection starts with /snap and copy to a new policy removing "snap" and also with a change in storage unit as mentioned above..

Can we have a script to do this operation. This will save my 3-4 hours job if successful. Points to all inputs.

Regards,
Syam
6 REPLIES 6
Leif Halvarsson_2
Honored Contributor

Re: Veritas Script

Hi,
It had perhaps been easier if you had attached an example.

Is a "policy" a file ? to copy files, containing a specific string you can use "grep -l".

for file in $(grep -l /snap *)
do
cp $file
done

then you can use sed on the files for editing

for file in *
do
sed '/s/snap//' >${file}1
done
Leif Halvarsson_2
Honored Contributor

Re: Veritas Script

Sorry,

It should be:

sed '/s/snap//' $file >${file}1
Ranjith_5
Honored Contributor

Re: Veritas Script

Hi leif,

Thanks for your replies. I am sorry but I dont know which is the file where the policy name, attributes, backup selections and schedules are stored. I myself consider veritas as an elephat as it is very complicated in the command line level.

I am still in search for the answers of above questions. If any one can point out / give clues ..will be a great help.

Regards,
Syam
Rick Garland
Honored Contributor

Re: Veritas Script

policy info is stored in /usr/openv/netbackup/db/class

Sandman!
Honored Contributor

Re: Veritas Script

Syam,

There are many ways to do this if you could at least provide a sample input then that would help.

thx
Ranjith_5
Honored Contributor

Re: Veritas Script

As rick pointed out the policy data is inside the /usr/openv/netbackup/db/class folder with individual policy name. for eg. Policy anc will have a folder called abc under /usr/openv/netbackup/db/class.

Each policy is having individual folders under /usr/openv/netbackup/db/class.

As mentioned above I have a policy called Bkp_Server1_Snap_d00.

the directory structure is as follows.

astersvr:root-/tmp/Bkp_Server1_Snap_d00>ls -lR
total 6
-rw------- 1 root sys 106 Aug 20 07:28 clients
-rw------- 1 root sys 9 Jul 3 02:36 includes
-rw------- 1 root sys 777 Aug 20 07:30 info
drw-r-xr-x 3 root sys 96 Jul 10 13:22 schedule

./schedule:
total 0
drw-r-xr-x 2 root sys 96 Jul 10 13:22 Manual

./schedule/Manual:
total 4
-rw------- 1 root sys 42 Jul 10 13:22 days
-rw------- 1 root sys 339 Jul 10 13:22 info
mastersvr:root-/tmp/Bkp_Server1_Snap_d00>
mastersvr:root-/tmp/Bkp_Server1_Snap_d00>
mastersvr:root-/tmp/Bkp_Server1_Snap_d00>

I want few changes in the newly created policies.

Copy the policy to a new name removing the string "Snap_" as shown above.

2. Change the stu name from test1_stu to test2_stu

3. Change the backup selection by just removing the string "snap".

How can I achieve all these in a script.

Attached the policy folder in a winzip format. You can get all the required inputs from that.

Regards,
Syam