Top
Systemwalker Operation Manager  Reference Guide
FUJITSU Software

17.3 Job End Exit

This section explains the exit program called when a job registered on Jobscheduler ends.

[Windows]

The system searches for the jobexit.bat file first, and then in jobexit.exe as the exit program. The exit program found in the search will be used. If jobexit.bat is found, jobsexit.exe will not be called up 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 jobsch.job.exit file as the exit program.

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/FJSVJOBSC/bin

HP-UX:

/opt/FHPJOBSCH/bin

AIX:

/usr/FAIXJOBSC/bin

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 (5) (Note1)

argv[0] :

Exit program name

argv[1] :

Name of project where the job net is registered

argv[2] :

Job net name

argv[3] :

Job net comment

argv[4] :

Temporary file name

argv[5] :

Subsystem number (character string) (Note2)

Note1:

In Systemwalker Operation Manager EE, the number of parameters is six.

Note2:

This parameter is used in Systemwalker Operation Manager EE.

In the temporary file, job information is stored as follows:

Job name
Completion code
Status

The following explanations describe each of the types of information shown above:

Job name:

Depending on execution attributes, the following contents are stored.

If a child job net is registered as a job, the name of the child job net will be stored.

If a linked job net is registered as a job, the name of the linked job net will be stored.

When the execution attribute is "Job Execution Control":

This is a job name. If the job name is omitted, the string registered as a command will be stored.

When the execution attribute is "Interstage":

This is a job workunit name.

When the execution attribute is "PowerAIM" [UNIX]:

This is a job workunit name.

When the execution attribute is "Normal" [UNIX]:

This is a command name.

Completion code

This is a job completion code (0 to 256 characters).

Status:

The job status is one of the following four strings.

normal_end:

Indicates completed.

pseudo-normal:

Indicates pseudo-normal completion.

abnormal_end:

Indicates abended.

canceled:

Indicates canceled.

The temporary file is created in the following directories:

[Windows]

In the work directory under the database directory of Jobscheduler

The name of the file is created in JOBnnn.tmp (nnn is appended by the system) format.

[Solaris, HP-UX]

/var/tmp directory

[AIX, Linux]

/tmp directory

Since the temporary file is not deleted on the Jobscheduler side, you must delete it from the exit program.

If the exit is not registered, the temporary file is not created.

About the Job in Passed Status

If the execution condition of the following job is specified in Condition concerning completion code of preceding job, the job end exit will not be activated on a job that ends with the Passed status.

A job that is waiting using the OR condition and is then canceled because of the OR condition of the following job will be processed as follows:

Cautions

Program Example

Below is an example program for the job end exit:

[Windows]

/* When a job ends, sends the following messages to "MANAGEMENT" server.
              Job name is ended !! code = completion code
*/
#include <stdio.h>
#include <string.h>
#include <process.h>

main(int argc, char *argv[])
{
    FILE *fp; 
    char jobname[100];
    char jobcode[100];
    char cmdline[256];

    fp = fopen(argv[4], "r"); 
    fgets(jobname, 99, fp); 
    jobname[strlen(jobname)] = '\0';
    fgets(jobcode, 99, fp); 
    jobcode[strlen(jobcode)] = '\0';
    fclose(fp); 

    sprintf(cmdline,
            "NET SEND MANAGEMENT %s is ended !! code = %s",
            jobname,    //job name
            jobcode);   //completion code

    system(cmdline);

    unlink(argv[4]);    // temp file is deleted
    exit(0);
}

[Solaris]

/* 
  Example program for the job end exit (for UNIX) which outputs a job completion message
  with a job name and completion code on the console 
*/

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

main(int argc, char **argv)
{
    FILE           *fp; 
    char             jobname[100];
    char             jobcode[100];

    memset (jobname, 0x00, sizeof (jobname));
    memset (jobcode, 0x00, sizeof (jobcode));

    fp = fopen(argv[4], "r"); 
    fgets(jobname, sizeof (jobname), fp); 
    jobname[strlen(jobname)-1] = '\0';
    fgets(jobcode, sizeof(jobcode), fp); 
    jobcode[strlen(jobcode)-1] = '\0';
    fclose(fp); 

    openlog ("jobsch", LOG_CONS, LOG_USER);
    syslog (LOG_WARNING,
         "WARNING: job end.  project=%s,  net_name=%s,  net_comment=%s,  job name=%s,  job_code=%s", 
         argv[1], argv[2], argv[3], jobname, jobcode);
    closelog();

    unlink (argv[4]);
    exit(0);
}