Usage of pre and post scripts

Central Management Console
Last Updated: Oct 31, 2012 09:09PM PDT

The success control of pre-/post-scripting by Central Management is not performed by checking
the exit code of the scripts (exit 0 for instance) but by the existence of a file in the
directory where the scsipt(s) reside.

The name of the file is "scriptname_with_extension".ok on UNIX/Linux, in UNIX Shell syntax $0.ok.
The name of the file is "scriptname_without_extension".ok on Windows, in Windows command language %~pn0.ok.

Example:
Script name is
/Hiback/tools/prescript.sh
OK file name must be
/Hiback/tools/prescript.sh.ok

The Central Management removes the OK files of pre- or post-scripts right before the script is started.

On UNIX/Linux, the end of a script must read

echo SomethingOrNothing > $0.ok
exit 0

 

On Windows, the end of a script must read

echo SomethingOrNothing > %~pn0.ok
exit 0

 

The script writer personally decides if and on which condition the OK file is created by the script.
For instance, if a command executed inside the script is crucial for the success of the script and the command fails, it is a good idea not to create an OK file for this script run.
Doing this, the script will be seen as unsuccessfully finished and further processing will not be done.

In order to add information available inside the script to the job results, use the file
/Hiback/msg/$1.cif
on UNIX/Linux or
InstallDir\Hiback\msg\%1.cif
on Windows.

This file will get transferred to Central Management at the end of the job and will be part of the result file in the "Customer defined information" section.
Use it like this for example to show the exit codes of the 2 mount commands in the result file:

echo prescript command results > /Hiback/msg/$1.cif
mount x
RC=$?
echo RC von mount x ist $RC >> /Hiback/msg/$1.cif
mount y
RC=$?
echo RC von mount y ist $RC >> /Hiback/msg/$1.cif

The echoed text will then be part of the result file in the "Customer defined information" section.
 

NovaCare Status

NovaStor Support

Contact Us

  • E-Mail NovaStor Support

    Click Here to submit your case to the NovaStor Support Team.

  • Phone Support

    If you have NovaCare Support you can call our support line:

    US Support:
    Call +1(805) 409-3140
    Press 2 for Technical Support
    Monday through Friday
    8am - 5pm PST

    EMEA Support:
    Call +49 (40) 63809 - 989
    Monday through Friday
    9am - 5pm CET (GMT+1)

TeamViewer