Hitachi

JP1 Version 12 for UNIX Systems JP1/File Transmission Server/FTP Description, Reference and Operator's Guide


3.3.1 Registering auto-start programs

The following features characterize auto-start programs:

The following table lists and describes each item in the auto-start program.

Table 3‒3: Items in the auto-start program

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.

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. If you enter a forward slash (/) at the end of a file name or directory name, the last forward slash becomes invalid and is deleted.

For the path of a file name or directory 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.

About JP1EVENT specification

Events cannot be issued by specifying JP1EVENT for program names supported in older versions. To issue an event, use the JP1/Base jevsend command and specify a full path.

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‒1: 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

5: SSL communication error

Y

Y

SYCN

System call name

Y

Y

ERNO

Error number

Y

Y

PLMG

Protocol message

Y

--

SSLE

SSL communication error number

Y

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 ftsautoma command is used to register auto-start programs. Specified values must be enclosed in double quotation marks ("").

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Δ12ΔaccountingΔ1Δ2Δ30000 (Δ: 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.

Blocking signals

Auto-start programs are started with the signals below masked by sighold(). Therefore, if a program received the following signals, the signals are put on hold:

  • SIGTERM

  • SIGCHLD

  • SIGHUP

By using the environment variable JP1FTS_AUTO_SIGNALMASK_DELETE, auto-start programs can receive the above signals. In addition, in Linux, if you do not use the environment variable JP1FTS_AUTO_SIGNALMASK_DELETE, the action for the SIGCHILD signal for that program is set to SIG_IGN when an auto-start program starts. For this reason, if you call the system() function in the auto-start program, the system() function returns an error (errno = 10). To avoid this error, set the action for the SIGCHLD signal to SIG_DFL before calling the system() function.

The following figure shows an example of a command for registering 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.