Hitachi

For UNIX Systems Job Management Partner 1 Version 10 Job Management Partner 1/File Transmission Server/FTP Description, Reference and Operator's Guide


3.3.1 Registering auto-start programs

The following features characterize auto-start programs:

This subsection describes how to register auto-start programs using the Auto-Start Program Registration window and using the ftsautoma command.

Organization of this subsection

(1) Using the Auto-Start Program Registration window

To register auto-start programs using the Auto-Start Program Registration window:

  1. In the Auto-Start Program Registration window, from the Edit menu, choose Register and then For File Trigger or For Directory Trigger. Alternatively, select existing registration information, and then from the Edit menu, choose Register and then For File Trigger or For Directory Trigger.

    The Register Auto-Start Program dialog box appears.

    Figure 3‒3: Register Auto-Start Program dialog box (for files)

    [Figure]

  2. Specify the items and then click Register.

    You can make entries for multiple auto-start programs one after another until you click Cancel.

  3. After registering the programs, click Cancel.

The following table lists and describes each item in the Register Auto-Start Program dialog box.

Table 3‒3: Items in the Register Auto-Start Program dialog box

Item

Setting

User name

Specifies a user name for registering an auto-start program. This item is mandatory.

The following users can be registered in auto-start programs:

  • Users who can log in to JP1/FTP (users registered in the OS)

  • .default (default users)

    This specification can be applied to all users (registered in the OS) who can log in to JP1/FTP. If there is no registration information that corresponds to individual users, JP1/FTP references the default user registration information. If an applicable item is found, JP1/FTP performs automatic start.

When a user name is already set in User name:

If a user has been specified in Info. For Specific User in the View menu, that user name is displayed here. From the View menu, choose Info. For All Users.

File name/Directory name

((1 to 256-byte character string))

Specifies the name of the file or directory that is to be subject to automatic start.

If you specify a file, specify its full path or only the file name. If you specify a directory, specify its full path.

For the path of a file name, specify the real path, not a path that includes a symbolic link.

This item is mandatory.

Program to start when transmission ends normally

Program to start when transmission ends abnormally

((2 to 256-byte character string))

Specifies the program to start when transmission terminates normally and/or when transmission terminates abnormally.

For the name of a program to start, specify its full path. When the program starts, transmission information can be passed as arguments. For details, see Parameter keywords.

Priority of program start

If multiple auto-start programs have been registered, the start condition (file name or directory name) might be applicable to more than one of the programs. In such a case, JP1/FTP searches the programs based on the priority order described below and starts only the first program that satisfies a priority condition. The following figure shows the priorities.

Figure 3‒4: Priority of starting auto-start programs

[Figure]

Note about the specification of "Program to start when transmission ends normally" and "Program to start when transmission ends abnormally"

If an argument contains the character \, be aware that some programs might interpret this character as an escape symbol.

Parameter keywords

You can pass all the transmission-end information items to the user program by specifying a keyword in the auto-start program. You can also use keywords to pass specific transmission-end information items. The following table lists and describes the keywords.

Table 3‒4: List of parameter keywords

Parameter keyword

Information that is output

Client

Server

ALL

All items

Y

Y

TRNO

Transmission number

Y

Y

TCNO

Connection number

Y

Y

CARD

Card name

Y

--

HOST

Connection-target host name or IP address

Y

--

Connecting client's IP address

--

Y

PORT

Connection-target host's port number

Y

--

USER

Login user name

Y

Y

TRTP

Transmission mode:

1: ASCII

2: Binary

Y

Y

TRCM

Transmission command:

1: Send

2: Receive

3: Append

Y

Y

COMP

Compression mode:

1: Stream

2: Compress

Y

Y

LCFN

Local file name

Y

Y

RMFN

Remote file name

Y

--

STTM

Transmission start time (return value of time())

Y

Y

SPTM

Transmission end time (return value of time())

Y

Y

TRSZ

Transmission data size (bytes)

Y

Y

CMNT

Comment

Y

--

TRST

Transmission end status:

1: Success

2: Failure

Y

Y

ERKD

Error type:

1: System call error

2: Logical error

3: Protocol error

4: Termination error

Y

Y

SYCN

System call name

Y

Y

ERNO

Error number

Y

Y

PLMG

Protocol message

Y

--

Legend:

Y: Enabled

--: Disabled

About keyword specification

If any keyword other than the ones shown in the table above or an invalid keyword is specified, the specified keyword is passed to the user program.

Example of argument specification

The following shows an example of specifying arguments when the Auto-Start Program Registration window is used to register auto-start programs.

Example:

/users/accounting/PROC TRNO USER TRCM COMP TRSZ

When the above arguments are specified, the user program is executed in the following format:

/users/accounting/PROC[Figure]12[Figure]accounting[Figure]1[Figure]2[Figure]30000 ([Figure]: space)

  • Transmission connection number: 12

  • Login user name: accounting

  • Transmission command: Send

  • Compression mode: Compress

  • Transmission data size: 30,000 bytes

Information can be received as program arguments.

Standard input/output

The standard input/output is closed. You can allocate the standard input/output to files. For details, see the JP1FTS_AUTO_STDIO environment variable listed in Table 3-2 in 3.1.3 Using environment variables to define a JP1/FTP environment.

Environment for the process

The JP1/FTP daemon environment is used, not the environment that is set based on the profile of the login user.

How to start programs when multiple files are transmitted

If a wildcard is used to transmit multiple files, an auto-start program is started as many times as there are file transmissions. Information is inherited to the auto-start program separately for each transmission. The transmission information cannot all be inherited to the auto-start program at once.

(2) Using the ftsautoma command

The following figure shows an example of a command for registering new auto-start programs:

[Figure]

This command registers the following information:

For details about the ftsautoma command, see ftsautoma - registers, deletes, and displays auto-start programs in 6. Commands.