Wednesday, May 23, 2012

HP Data Protector - Fail job on mount request

If you want a HP Data Protector job to fail on a mount request, you can do this by creating a script abort.bat to replace the default Mount.bat script. The contents if the abort.bat script should be the following:


@echo off
set THIS=%0
set USER=%1
set GROUP=%2
set HOSTNAME=%3
set STARTPID=%4
set DEVNAME=%5
set DEVHOST=%6
set DEVFILE=%7
set DEVCLSS=%8
set DEVCLASSNAME=%9
shift
shift
shift
shift
shift
shift
shift
shift
shift
set MEDID=%1
set MEDLABEL=%2
set MEDLOC=%3
set POOLNAME=%4
set POLICY=%5
set MEDCLASS=%6
set MEDCLASSNAME=%7
set SESSIONKEY=%8

omniabort.exe -session %SESSIONKEY%

Edit 20/07/2012 in DP 6.11 you need to leave out C:\Program Files\OmniBack\bin\ before omniabort.exe -session %SESSIONKEY% otherwise the script will not run.


(You maybe need to change the path of the omniabort.exe but on windows installation it's normally installed in this directory).

To change the script that's run on a mount request you need to go to the Device properties => Settings => Advanced => Other.

Source


7 comments:

  1. Hello Peter

    Thank you for this.

    I have a question regarding this line, on your script :

    omniabort.exe -session %SESSIONKEY%

    The Session key changes every day for the same routine; example for "My_Daily_Server_Backup_Job"
    The session key will be something like : 2012/07/30-1

    But how does this work if I want to run this script every day for this job, since the session key changes everyday ?

    Thanks & regards,

    Anthony

    ReplyDelete
  2. Peter

    Humm...I was thinking :

    is "%SessionKey%" a Constant or a Variable ???

    Thanks for letting me know.

    Anthony

    ReplyDelete
  3. Hi Anthony, the %SessionKey% is a Variable, so DP will pass the key for example "2012/07/30-1" to the script.

    ReplyDelete
  4. Hello Peter,
    After days I spent working on the problem, I eventually found out that this %SessionKey% thing was NOT a variable... in my case.

    If you want DP to cancel "Mount Requests" automatically, you HAVE TO alter the mount.bat file in the first place so that it looks like this :

    @echo off
    set THIS=%0
    set USER=%1
    set GROUP=%2
    set HOSTNAME=%3
    set STARTPID=%4
    set DEVNAME=%5
    set DEVHOST=%6
    set DEVFILE=%7
    set DEVCLSS=%8
    set DEVCLASSNAME=%9
    shift
    shift
    shift
    shift
    shift
    shift
    shift
    shift
    shift
    set MEDID=%1
    set MEDLABEL=%2
    set MEDLOC=%3
    set POOLNAME=%4
    set POLICY=%5
    set MEDCLASS=%6
    set MEDCLASSNAME=%7
    set SESSIONKEY=%8

    E:
    E:\OmniBack\bin\omnimnt.exe -device %DEVNAME% -session %SESSIONKEY% -cancel

    and then restart the DP services on the Cell Server.
    Once again, there are no variables involved in this case.

    Cheers.
    Anthony

    ReplyDelete
  5. Hey Anthony,

    maybe I get you wrong but %SESSIONKEY% and %DEVNAME% are still variables in your sample. They are replaced with the values passed to the bat file. See the lines:
    set DEVNAME=%5
    ...
    set SESSIONKEY=%8

    But maybe we have a different understanding of variables.

    It's also right that after doing a major change to DP settings, it's a good practice to run omnisv -stop and omnisv -start

    ReplyDelete
  6. Hello Peter,

    By this I meant : the very last line does not change, this script is working as it shows on any of my cell servers. My tests are ok.

    Furthermore, if you want to decrease the "Mount Request" delay to let's say 2 minutes, you'll also have to update the global option file (c:\omniback\config\server\options\global) and add the line "MountDelalay=02" in there then restart the DP services.

    Cheers
    A

    ReplyDelete
  7. This week, I even noticed something odd on DP v6.00 :

    In the "mount.bat" file, I had to remove the comments - those starting with single quotes ' - as for some reason single quotes are ignored by DP.

    As soon as I removed the comments, the script started working OK.

    ReplyDelete