Top
Systemwalker Operation Manager  Reference Guide
FUJITSU Software

17.10 On-Demand Job End Exit

This section explains the exit program called when an on-demand job ends.

[Windows]

The system searches for the exit program first in mjesexit.bat and then in mjesexit.exe, and calls the exit program found. If mjesexit.bat is found, mjesexit.exe will not be called even if it exists.

If you want to use this exit to perform custom processing, create an exit program with the same name and store it in the following directory:

<Systemwalker installation directory>\ MpWalker.JM\bin

[UNIX]

The system searches for and calls the exit program in the mjes.job.exit.

If you want to use this exit to perform custom processing, create an exit program with the same name and store it in the following directory:

Solaris/Linux:

/opt/FJSVMJS/usr/lib/mjes

HP-UX:

/opt/FHPMJS/usr/lib/mjes

AIX:

/opt/FAIXMJS/usr/lib/mjes

Appropriate execution privileges are required to execute the exit program. If relevant privileges are not set, the exit program will not be called.

Parameters Passed to the Exit Program

The parameters passed to the exit program are as follows:

argc : Number of parameters (9)
argv[0] : Exit program name
argv[1] : Job name
argv[2] : Job number (character string)
argv[3] : Host name of the execution server where the job was executed
argv[4] : Queue name where the job was executed
argv[5] : Comment specified in the job
argv[6] : End code of the job (character string)
argv[7] : File name of the standard output file of the job
argv[8] : File name of the standard error output file of the job
argv[9] : Sub-system number (character string) (Note 1)

Note 1

This parameter is used in Systemwalker Operation Manager EE. 0 is set in Systemwalker Operation Manager SE.

Cautions

Program Example

The following are some examples of on-demand job exit programs:

[Windows]

/*
   If the job completion code is other than "0", the following message 
   is sent to the "MANAGEMENT" server:
     Job name is ended !! code = completion code
 */
#include <stdio.h>
#include <string.h>
#include <process.h>

main(int argc, char *argv[])
{
    char cmdline[256];
    int job_code = 0;

    job_code = atoi(argv[6]);

    if (job_code != 0) {
        sprintf(cmdline,
                "NET SEND MANAGEMENT %s is ended !! code = %s",
                argv[1],  //job name
                argv[6]); //completion code

        system(cmdline);
    }

    exit(0);
}

[Solaris]

/*
   If the job completion code is other than "0", a message is output
   to the console. The job name, job number, and the job 
   completion code are output.
 */

#include <syslog.h> 
#include <stdio.h>

main(int argc, char **argv) 
{
    int job_code = 0;

    job_code = atoi(argv[6]);

    if (job_code != 0) {
        openlog("mjes.job.exit", LOG_CONS, LOG_USER);
        syslog(LOG_WARNING, "WARNING: job end. job_name=%s, job_number=%s,
                            job_code=%s", argv[1], argv[2], argv[6]);
        closelog(); 
    }
    exit(0);
}