3.3.1 Registering auto-start programs
The following features characterize auto-start programs:
-
You can register different programs to start in the event of normal termination and abnormal termination of transmission.
-
The time at which a specified program starts depends on how the transmission file is specified:
- file-name is specified
-
The program starts when the specified file is transmitted.
- directory-name is specified
-
The program starts when a file is transmitted to the specified directory.
-
An auto-start program is executed when transmission is completed for the registered user. To register an auto-start program for all the registered users rather than for a specific user, specify .default in User name.
-
When you use the Auto-Start Program Registration window, you can either specify from scratch the auto-start programs to be registered or you can edit existing registration information to specify different auto-start programs. The ftsautoma command supports only the first method for registering 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:
-
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) -
Specify the items and then click Register.
You can make entries for multiple auto-start programs one after another until you click Cancel.
-
After registering the programs, click Cancel.
The following table lists and describes each item 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:
|
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 - 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
--
- 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/PROC12accounting1230000 (: 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:
This command registers the following information:
-
The target is a file (file).
-
The user name is accounting.
-
The file/directory name is file1.
-
-AS: The name of the program to start when transmission ends normally is /home/accounting/normal.sh.
-
-AF: The name of the program to start when transmission ends normally is /home/accounting/abnormal.sh.
For details about the ftsautoma command, see ftsautoma - registers, deletes, and displays auto-start programs in 6. Commands.