Using tape as a backup target
Post Reply
bsoosay
Enthusiast
Posts: 34
Liked: never
Joined: Oct 02, 2014 7:47 am
Full Name: Benjamin Soosay
Contact:

Pre-job script terminated with exit

Post by bsoosay »

Hi!

I'm trying to run a tape to file job. The server that I intend on using the tape to file job has been added to the Backup Infrastructure tab.

Now before the backup job runs, I need a script to run that renames certain files on my target server and then rename it back to the original after the backup is done.

I have placed these scripts on the target server and shared the folder and given full rights to the same account running the tape to file job.

In the Advanced tab of the tape to file job, I keyed in the path of the script as: \\10.60.15.13\Veeam_Scripts\changedoc.cmd

Now the moment I execute this job, I receive an error : Pre-job script terminated with exit code 1

What am I doing wrong, and what does this error message mean? How do I get Veeam Backup and Replication to execute that script on my target server prior to the backup and upon completion of the backup.

veremin
Product Manager
Posts: 17777
Liked: 1626 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Pre-job script terminated with exit

Post by veremin »

What particular commands are you using as pre-job command? Being command specific, error codes might have different meanings. Thanks.

PTide
Product Manager
Posts: 5585
Liked: 533 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: Pre-job script terminated with exit

Post by PTide »

Hi,

Have you tried placing the script in a local folder of your B&R server? Why to place it on a shared folder?

VB&R just outputs exit code received from an executed command.

Thank you.

bsoosay
Enthusiast
Posts: 34
Liked: never
Joined: Oct 02, 2014 7:47 am
Full Name: Benjamin Soosay
Contact:

Re: Pre-job script terminated with exit

Post by bsoosay »

I'm placing the script on the target folder because its suppose to change files on the target folder.

This is the script:

forfiles /p E:\Folder\Daily\ /s /m "*.doc" /c "cmd /c Ren @fname.doc *.olddoc" /d -03


When I run this script manually from the target server...it works perfectly. In fact, I used to use a different backup software and I used to run this same script from the target server, without any issues.

Why can't it work with Veeam?

PTide
Product Manager
Posts: 5585
Liked: 533 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: Pre-job script terminated with exit

Post by PTide »

Wait a second...

Where is your E:/Folder/Daily folder located? On backup server or on 10.60.15.13 ?

Thank you.

bsoosay
Enthusiast
Posts: 34
Liked: never
Joined: Oct 02, 2014 7:47 am
Full Name: Benjamin Soosay
Contact:

Re: Pre-job script terminated with exit

Post by bsoosay »

E:/Folder/Daily folder located?

Its located on the 10.60.15.13 (which is the target server)

PTide
Product Manager
Posts: 5585
Liked: 533 times
Joined: May 19, 2015 1:46 pm
Contact:

Re: Pre-job script terminated with exit

Post by PTide »

Your pre-job script is trying perform all actions specified on your backup server, i.e. it tries to locate E:/Folder/Daily on your backup server. Here are some advices:

1) It is no use keeping scripts on your target. Keep them on your backup server.

2)
forfiles /p E:\Folder\Daily\ /s /m "*.doc" /c "cmd /c Ren @fname.doc *.olddoc" /d -03
In order to make your script work you'll have to either:
a) specify a UNC (\\TARGET_NAME\shared\folder\) path to a shared folder instead of E:\Folder\Daily\ (don't forget about r/w permissions)
b) modify your script in such way that it starts some remote script/gets executed on a remote machine (psexec can do the job).

However, I'd better stick to option "b" in order to eliminate the shared folder from the schema completely.

Thank you.

alanwilliams
Novice
Posts: 4
Liked: never
Joined: Feb 25, 2016 5:56 pm
Full Name: Alan B. Williams
Contact:

Re: Pre-job script terminated with exit

Post by alanwilliams »

So I was referred to this article by your Veeam Support Team as a solution to my problem. If I understand this post correctly, if you need to execute code(script) on the guest(target) machine pre and post backup, you need to execute a remote PowerShell command to execute on the target machine? The target machine utilizes Custom PowerShell for Enterprise Vault in order for the pre and post commands to run. Initially, I was told the scripts were"uploaded" to the target workstation and then executed, which I'm finding not to be the case here. So to be specific, the scripts execute on the Veeam management server and you need to target the guests accordingly in your script, which is more difficult...

alanbolte
Expert
Posts: 635
Liked: 172 times
Joined: Jun 18, 2012 8:58 pm
Full Name: Alan Bolte
Contact:

Re: Pre-job script terminated with exit

Post by alanbolte »

Pre-freeze and post-thaw scripts in the guest processing settings of a VM backup job are uploaded to the VM being processed. Any other script is executed on the Veeam backup server.

alanwilliams
Novice
Posts: 4
Liked: never
Joined: Feb 25, 2016 5:56 pm
Full Name: Alan B. Williams
Contact:

Re: Pre-job script terminated with exit

Post by alanwilliams »

To confirm a minor detail, Pre-freeze and post-thaw scripts have to be in .bat form?

veremin
Product Manager
Posts: 17777
Liked: 1626 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Pre-job script terminated with exit

Post by veremin »

To confirm a minor detail, Pre-freeze and post-thaw scripts have to be in .bat form?
Exe and ps1 files can be also used. Though, in latter case (.ps1) some dirty tricks might be required. Thanks.

sramagir
Lurker
Posts: 2
Liked: never
Joined: Jun 19, 2018 10:11 am
Full Name: Shiva
Contact:

Re: Pre-job script terminated with exit

Post by sramagir »

I am having same issue. Can anyone let me know how did the issue got resolved.

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests