Hi, is possible run script to delete files after backup if ended ok ?
You can pass the job status as an argument to the post-process script. And you need to decide your business logic based on the status value.
Please check this documentation page and check the additional argument -status.
@Sunil beat me to it! You can set the pre/post process to run pretty much any script you can come up with. You (or commonly, a vendor) have to create the script itself, and we can execute it (as the listed user in the config).
Assuming you’d set this to run AFTER the backup phase, then you likely won’t encounter any issues with premature deletion; however, if the backup is killed BEFORE the script portion runs, then you’ll likely the files sitting in place where you expected them to have been deleted.
Is your intent to stage files in a folder, have them get backed up, then delete them after (to clear the staging area)?
“Is your intent to stage files in a folder, have them get backed up, then delete them after (to clear the staging area)? “ YES
Ok, great! This is a very common arrangement.
Here’s another thread where I shared some of my old troubleshooting techniques that will likely help you in testing:
Let me know if this answers your questions!
@Sunil sorry, do you have some examples? I am testing the solution, but probably I am wrong to pass the parameters...Thanks
C:\Users\xxxx\Documents\echo.bat "-status 1"
While we wait for @Sunil I am going to send this page to our documentation team to see if we can get examples added for clarity!
@Mike Struening I did some more tests, it seems that in my case you don't have to insert any arguments.…
waiting for confirmation....
@ITStorageEWL you don’t HAVE to add in that parameter; it’s there if you want to force the script to make a more informed decision to only run IF a prior event succeeded/failed, etc.
You should be able to test it out with a VERY small subclient with some random text files thrown in. Set the subclient to that folder only, set the script syntax to delete that folder’s content and run a full and see what happens.
@Mike Struening OK I'll try some more tests. Thanks
@Mike Struening does not work, the logs always show status 1, and it always runs the post process.
the correct syntax is
C:\Users\xxxx\Documents\echo.bat "-status 1".
should the status be tested outside or inside the script?
@ITStorageEWL the status argument will only prevent the script running if the prior phase has failed. Is the prior phase failing? If the backup phase works (assuming this is a post backup script), then the script will run.
I’ll tag in @Sunil for any additional context.
You can always just do it within the script as you said, though it might be tougher to monitor the phase of the backup/scan, etc.
@ITStorageEWL following up on this. Were you able to get the script running as desired?
@ITStorageEWL , let me know if this is resolved or if you need more help.
@Mike Struening we have not solved it, we are still testing. Need to figure out how to intercept status 1 of the backup phase.It would be interesting to find practical examples of both linux and windows.Thanks
@Sunil , do you have any examples of a script using the status argument?
Let me try it in the lab setup and get back.
Already have an account? Login
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
Sorry, our virus scanner detected that this file isn't safe to download.
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.