Batch to Automator

Last post 03-18-2020, 10:55 AM by agmavarok. 0 replies.
Sort Posts: Previous Next
  • Batch to Automator
    Posted: 03-18-2020, 10:55 AM

    Hello everyone, I try to devellop the default script issue to "As save as..." to interact with the scheduler Axway Automator.

    I would to retrieve all the status of a job ( 13 states )

    So i modify the script as below :

    ---------------------- begin of the script -------------------------
     
    @echo off

    setlocal

    if not defined GALAXY_BASE set GALAXY_BASE=C:\Program Files\Commvault\ContentStore\Base

    set PATH=%PATH%;%GALAXY_BASE%
    set response="RIT_MERIGN.tmp"
    set USERTOKEN=D:\XOS\Scripts\COMMVAULT\token

    rem qlogin -cs "server.domain.com" -csn "pwinsvcsav11" -tf C:\Script\Commvault\token
    rem if %errorlevel% NEQ 0 (
    rem echo Login failed
    rem goto endOfScript )


    :loopx
    if "%1"=="" ( goto loopz )
    set input=%input% %1
    shift
    goto loopx
    :loopz
    qoperation execute -af "D:\XOS\Scripts\COMMVAULT\RIT_MERIGNAC.xml" %input% -tf %USERTOKEN% > %response%
    if %errorlevel% NEQ 0 (
    echo Failed to execute operation.
    goto end_job )
    set /A isJob=0
    for /F "usebackq tokens=1*" %%i in (%response%) do (
    echo %%i %%j
    if "%%i" == "<jobIds" (
    set /A isJob=1 ) )
    if %isJob% NEQ 1 (
    goto end_job )
    :loopInitial
    for /l %%X in (1,1,6) do (cvsleep 20
    qlist job -co is -af %response% -tf %USERTOKEN% > output_job.result
    if %errorlevel% NEQ 0 (
    echo Failed to get job details.
    goto end_job )
    for /F "tokens=1,2" %%a in (output_job.result) do (if not %%a == No (goto loopEnd)
    echo %%a %%b))
    echo Failed to start job for long time.
    goto end_job
    :loopEnd
    for /F "tokens=1,2" %%a in (output_job.result) do (echo %%a %%b)

    echo Processing...
    :loop_job
    for /F "tokens=1,2,3,4" %%a in (output_job.result) do (if %%b == Running (goto loop1)
    if %%b == Waiting (goto loop1)
    if %%b == Pending (goto loop1)
    if %%b == Suspended (goto loop1)
    if %%c == Pending (goto loop1)
    if %%d == Pending (goto loop1)
    if %%b == Queued (goto loop1)
    rem Ajouté par FA
    if %%b == 'Completed w/ one or more errors' (goto ERR)
    if %%b == 'Killed' (goto ERR)
    if %%b == 'Failed to start' (goto ERR)
    if %%b == 'Failed' (goto ERR)
    )
    goto loop2

    :loop1
    cvsleep 20

    qlist job -co is -af %response% -tf %USERTOKEN% > output_job.result
    goto loop_job

    :loop2
    echo Final Job Status:
    for /F "tokens=*" %%a in (output_job.result) do (echo %%a )
    del output_job.result
    rem Ajouté par FA
    rem goto end_job

    rem Ajouté par FA
    :ERR
    echo SAUVEGARDE EN ERREUR
    set OrigErrLevel=1
    echo RC = 1
    echo RC = %OrigErrLevel%
    del %response%
    exit 1
    %TO_INSTALL_BIN_DIR%\bin\OPSEXIT 1


    :end_job
    set OrigErrLevel=%errorlevel%
    echo RC = %OrigErrLevel% > output_job.result
    del %response%
    if %OrigErrLevel% NEQ 0 exit /b %OrigErrLevel%


    :endOfScript
    rem Ajouté par FA
    %TO_INSTALL_BIN_DIR%\bin\OPSEXIT %OrigErrLevel%

     

    ---------------------- end of the script -------------------------
    it seems that the loop ERR: is read all the time by the scheduler.

    did i forget something ?
    Help appreciate .
    Thanks a lot
The content of the forums, threads and posts reflects the thoughts and opinions of each author, and does not represent the thoughts, opinions, plans or strategies of Commvault Systems, Inc. ("Commvault") and Commvault undertakes no obligation to update, correct or modify any statements made in this forum. Any and all third party links, statements, comments, or feedback posted to, or otherwise provided by this forum, thread or post are not affiliated with, nor endorsed by, Commvault.
Commvault, Commvault and logo, the “CV” logo, Commvault Systems, Solving Forward, SIM, Singular Information Management, Simpana, Commvault Galaxy, Unified Data Management, QiNetix, Quick Recovery, QR, CommNet, GridStor, Vault Tracker, InnerVault, QuickSnap, QSnap, Recovery Director, CommServe, CommCell, SnapProtect, ROMS, and CommValue, are trademarks or registered trademarks of Commvault Systems, Inc. All other third party brands, products, service names, trademarks, or registered service marks are the property of and used to identify the products or services of their respective owners. All specifications are subject to change without notice.
Close
Copyright © 2020 Commvault | All Rights Reserved. | Legal | Privacy Policy