Job execution (OP)

Jobs can be started in multiple ways. The job’s status defines how you can start the job. You can start the job if the job’s status is In Queue or Free.

In Queue status

If the job’s status is In Queue, you can use the Job Scheduler BSE Service to start the job. Ensure the Job Scheduler BSE Service is running before it can activate any job.

Jobs with status In Queue can be monitored using the Scheduled Jobs (ttaad5120m000) session. This session shows an overview of all scheduled jobs across all companies and displays the this information:

  • Company: The company in which the job is created.
  • Job code
  • User: The owner of the job.
  • Next Execution: Shows the date/time when the job will be started.
  • Status: The status can be:
    • Waiting
    • Starting
    • Running
    • Failed to Start

      For jobs with status Failed to Start, an error is logged. After that, a new attempt is made to start the job.

  • Hostname: The name of the server where the job is running.
  • Bshell ID: The process ID of the bshell starting the job, when the job is running.

Jobs started by the Job Scheduler BSE Service are carried out by a separate bshell. This bshell runs in the company of the job, using the settings of the LN user who created the job.

Job Daemon

In case BSE Services are not used, you can use the Job Daemon to start the job. Ensure the Job Daemon is running before it can activate any job.

The implementation of the Job Daemon depends on the operating system of the LN server:

  • On a UNIX server
    The Job Daemon is the shell program rc.startjobdm, which is located in the ${BSE]/etc directory. To start the Job Daemon, you can include the ${BSE}/etc/rc.startjobdm command in the ${BSE}/etc/rc.start file. As a result, the Job Daemon is activated when you start the LN environment.
  • On a Windows server
    The Job Daemon is a service that you can manage by means of the Application Services Manager (ASM)

When the Job Daemon runs, you can stop your bshell without any problem. The Job Daemon, and not your bshell, carries out the job.

To run a job for multiple companies, you must start a Job Daemon for each company.

See Job handling procedure (OP).

Free status

If the job’s status is Free, you can start the job in these ways:

  • Use the Activate Job (ttaad5203m000) session
  • Use the rc.startjob shell command (UNIX platform)
  • Use the startjob.bat batch file (Windows platform)
Activate Job (ttaad5203m000)

If you start the job before the time and date of execution, the job’s status changes to Waiting. While the job is being carried out, the job’s status changes to Running. Because the bshell of the user who starts the job carries out the job, the user cannot quit the bshell until the job is finished.

To start a job that belongs to more than one company, you must use the Change Company command on the Menu browser’s Option menu to switch to the required company.

The rc.startjob shell command (UNIX)

You can also start the job with the UNIX ${BSE}/etc/rc.startjob shell script. For this purpose, you must enter this syntax at the UNIX prompt: ${BSE}/etc/rc.startjob [job name].

You can include the rc.startjob script in a UNIX user job scheduler (crontab), which can automatically start jobs. For this purpose, some UNIX variables must be defined in the shell script. For more information, see the shell script.

To run a job for multiple companies, you must create a unique version of rc.startjob for each company.

The startjob.bat batch file (Windows)

If LN runs on a Windows server, you can also start the job with the startjob.bat batch file.

To start a job, specify this syntax at the Windows command prompt: startjob.bat [job name]

Before you can specify this command, you must run the fillenv.bat batch file to set the LN environment variables.

To automate the execution of jobs, you can run startjob.bat with a scheduler.

To run a job for multiple companies, you must create a unique version of startjob.bat for each company.

See Job handling procedure (OP).

Job status

This table shows the statuses a job can have during its life span:

StatusDescription
FreeThe job’s basic job data is defined and is ready to be started.
RunningThe job is started and is running.
Waiting

The job is started and is waiting to be carried out at the next execution date and time.

The Job Daemon will not start the job.

In queueThe job is queued and is started automatically when the Job Daemon runs.
BlockedThe job is blocked and cannot be started. To start the job, set the status to Free or In Queue.
CanceledThe job is stopped with the Cancel Jobs (ttaad5204m000) session. A job is also canceled when the maximum duration is exceeded.
Runtime errorThis status signals an error during the execution of the job.

 

If required, you can cancel a job that the Job Daemon starts, for example, to change the job’s basic job data. To cancel the job, use the Job Data (ttaad5500m000) session. On the appropriate menu, click Cancel Job. If you cancel a job, the current session of the running job is carried out, but the following sessions in the job will not be started. The job’s status changes from In Queue to Canceled. To restart a canceled job, you must release the job to change the job’s status to In Queue or Free.

To temporarily stop a job, start the Job Data (ttaad5500m000) session. On the appropriate menu, click Block Job.