cancel
Showing results for 
Search instead for 
Did you mean: 

Delete files and folder after backup completed

iaw
Level 5

Hi,

I use NBU 7.x
I want to delete files and folders after the file system backup completed successfully.
Is there any feature for this? or I need to create post script?
Any example script for this?

Thanks,

IAW

2 ACCEPTED SOLUTIONS

Accepted Solutions

Marianne
Moderator
Moderator
Partner    VIP    Accredited Certified

We call it User Archive and can only be done manually from the client.

On the master, you need to have a policy for the client with a schedule of User Archive type with an open window during which this action will be allowed.

If there is a file list in Backup Selection, it will have no effect on the archive.

On the client, a local admin can open BAR window, select folders/files, and start the archive.
The user can also run bparchive from cmd. (See Commands manual for usage).

 

View solution in original post

Alex_Zn
Level 6
Partner Accredited

Hi, there is no feature for this in NBU, but it may be done using the next steps:

1. Get file bpend_notify.cmd from "bin\goodies" on master or media server and copy it to client computer.

This is script wich will be executed any time you run policy, if you want to bind it to some specific schedule (for example run it only after full backup) rename it like bpend_notify[[policy_name].[schedule_name]].cmd

Because script runs any time you have to verify is schedule was successful,  in other case we may delete files that was not backed up.

2. Replace all in bpend_notify.cmd with next:

echo off

echo =============================================== >> bin/BACKUP_RESULT.txt

if "%4" == "FULL" goto FULL

goto EOF

:FULL

               if NOT %5% == 0 goto FAIL

 

               echo %date% %time% >> bin/BACKUP_RESULT.txt

echo full backup finished on %1 using policy %2 with schedule %3 and status SUCCESSFULL >> bin/BACKUP_RESULT.txt

                echo start deleting files... >> bin/BACKUP_RESULT.txt

 

The last string should be delet command. But before you run it test it very well in other case there is a risc to destroy your data.

 

View solution in original post

12 REPLIES 12

Marianne
Moderator
Moderator
Partner    VIP    Accredited Certified

We call it User Archive and can only be done manually from the client.

On the master, you need to have a policy for the client with a schedule of User Archive type with an open window during which this action will be allowed.

If there is a file list in Backup Selection, it will have no effect on the archive.

On the client, a local admin can open BAR window, select folders/files, and start the archive.
The user can also run bparchive from cmd. (See Commands manual for usage).

 

iaw
Level 5

So, is it posible for auto schedule? (no manual operator interuption)

Thanks

Marianne
Moderator
Moderator
Partner    VIP    Accredited Certified

It cannot be scheduled using NetBackup. As per my post above - can only be done manually from the client

The only way to automate it is to create a script on the client and use another scheduler (e.g. cron on Linux client) to schedule it.

StefanosM
Level 6
Partner    VIP    Accredited Certified

Another way to start a user archive is to create a backup with a full and a user archive schedule.
Use the automatic backup to backup a single file and start a bpstart_notify script.

The script will have a bpbackup command to start the user archive backup.
 

when I use this approach and because of the bpstart timeout I have a separate bpbackup script and call it from bpstart_notify.

This is like the approach of a database backup

huanglao2002
Level 6

yes,you can follow Stefanos Monovasios advise.

CraigV
Moderator
Moderator
Partner    VIP    Accredited

...bit of a nonsense post. Please post when you have something of value to add!

Thanks!

Alex_Zn
Level 6
Partner Accredited

Hi, there is no feature for this in NBU, but it may be done using the next steps:

1. Get file bpend_notify.cmd from "bin\goodies" on master or media server and copy it to client computer.

This is script wich will be executed any time you run policy, if you want to bind it to some specific schedule (for example run it only after full backup) rename it like bpend_notify[[policy_name].[schedule_name]].cmd

Because script runs any time you have to verify is schedule was successful,  in other case we may delete files that was not backed up.

2. Replace all in bpend_notify.cmd with next:

echo off

echo =============================================== >> bin/BACKUP_RESULT.txt

if "%4" == "FULL" goto FULL

goto EOF

:FULL

               if NOT %5% == 0 goto FAIL

 

               echo %date% %time% >> bin/BACKUP_RESULT.txt

echo full backup finished on %1 using policy %2 with schedule %3 and status SUCCESSFULL >> bin/BACKUP_RESULT.txt

                echo start deleting files... >> bin/BACKUP_RESULT.txt

 

The last string should be delet command. But before you run it test it very well in other case there is a risc to destroy your data.

 

iaw
Level 5

Thanks for all the valued suggestions.

@Alex: great, I will give it try.

 

Alex_Zn
Level 6
Partner Accredited

If it will work for you, do feel free to mark my comment as solution :)

jim_dalton
Level 6

User archiveas per MVDB: its an attribute of the schedule within a policy. Approach with caution at all times, especially if writing wrappers around these things.

Im sure you could just write a post script  and kill your data once the backup status is good as perl Alex, ie use a backup policy, but well you need to be careful with files in use, half written and so on.

jim

iaw
Level 5

Thanks all for the valued reply.
I will test it whenever I'm in the implementation phase.

Regards,

IAW
 

Marianne
Moderator
Moderator
Partner    VIP    Accredited Certified

NO!!! This is NOT a solution!

A solution is a post that has answered your query!