tape-socket Command

For Windows: Not Supported

The tape-socket BASIC program defines a tape system across a network.

Syntax 

tape-socket {cmd {keyword=value} {(options}}

Parameter(s)

options

c

Does not clear the pipes before starting a server. This option should be used only if data in the pipe should be preserved. This situation normally arises only when the server is stopped in the middle of a communication. Extreme care should be taken when using this option.

q

Quiet option suppresses some user messages and confirmation prompts when stopping servers and draining pipes.

r

Displays only running servers in the status option.

s

Suppresses the synchronization of clocks at startup time.

v

Verbose option records all events in the log file.

The tape-socket TCL command is used to create the input or output server and control their activity. A tape-socket log file ts.log is created the first time the command is started to record the process activity, and a permanent log ts.log,log keeps all messages.

This command can be executed only on the dm or SYSPROG account. It requires a sys2 privilege.

Commands

The variable cmd represents one of these commands below (where allowed abbreviations are shown between parentheses):

Command

Abbreviation

Description

check

ch

Checks remote server.

drain

dr

Drains (empties) pipe.

listpipes

lp

Lists pipe status.

listserver

 

Lists the servers.

query

q

Queries a server.

setarg

 

Changes argument.

setup

 

Sets up server parameters.

show

 

Displays server parameters.

shutdown

 

Stop both servers.

start

 

Starts a server by name.

startall

 

Starts all servers.

startsend

ss

Starts the output server.

startreceive

sr

Starts the input server.

status

sta

Lists the server status.

stop

sto

Stops a server.

stopall

stopa

Stops all servers.

tltest

 

Tests whether transaction logging is operational.

traceon

tron

Turns traces on.

traceoff

troff

Turns traces off.

version

vers

Displays the version.

Without any argument, a menu displays, showing the most useful options to manage the default server. The menu is described later in this topic.

Arguments

The arguments are specified by a series of statements keyword=value. Arguments can be specified in any order. If the value is a question mark, the user is asked to enter a value for the specified keyword, at which point a question mark, help, and q (quit) displays. If the value is a period, the value used last is substituted. These forms are used in macros where keyword is one of these specified arguments:

callrep

Number of attempts the output server does to call the input server. After this number has been reached, and if the input server does not respond, the output server terminates. The value of 0 means an infinite number of attempts to call. The default value is 0. A 5 second delay occurs between each attempt.

cmd

Command to be executed on the remote system. This form is used to check the communication link.

host

Network name of the host where the input server resides. This argument is required only for the output server to be able to reach the input server. The host name must be defined in the /etc/hosts file in the sender.

ndisc

Maximum number of network disconnections either server tolerates. A value of 0 means an infinite number. When a network disconnection occurs, the output server will try to call the input server again. The default value is 0.

notify

Name of one or more D3 users to whom error messages are sent. The notify list may have one of these forms:

off

Disables the notification.

user

D3 user name.

! line

D3 line number

*

All D3 users.

exec cmd

Runs the specified keyword command.

NOTE—More than one user can be specified, by separating each user by a comma (for example, notify=bob,sam). If the form cmd is used, the entire notification list must be enclosed between quotation marks, because of the space that follows the  exec command. For example:

notify="dm,!0,exec run bp send-mail

The text of the error message is added after the specified keyword command. The users must exist in the dm,users, file.

pib

Port number of the server. This option can be used as an argument to the query and stop commands as a quick alternative to the form pipe=device.

pipe

Defines the UNIX pipe. A full path name must be provided (for example, /dev/tapein). The pipe must exist and have appropriate read/write permissions. A raw device name is accepted as well.

poll

Defines the period with which the transaction logger is tested. poll is expressed in seconds, or in hh:mm:ss format. A value of 0 disables the transaction log test polling.

port

Socket port number in decimal of the input server on the receiver’s side. The socket port number is a convention between the input and output server. It is a decimal number between 1024 and 32767.

prot

Network protocol. These protocols are supported:

inet

Internet.

server

Name of the server. If left empty, the default server is used. The server name can be any string.

servertype

Type of server option is required when using the setup command to set up the running parameters of a server. The server type is either for the input server, or for the output server.

trace

Maximum number of traces either server keeps in the log file. The default value is 4. Without the verbose (v) option, only major events are recorded. The (v) option records all data. When this number is exceeded, the oldest trace entries are discarded.

txlog

Specifies whether the server is to be linked automatically to the transaction logger. The transaction log is either on, or off.

txopt

Specifies whether the transaction logger should log updates to all files, or only to files with the (dl) attribute. This option is valid only for the output server, if txlog=on. The txopt option is either dl or all.

txpriod

Specifies the period, in seconds, with which the transaction log queue is emptied. A value of 0 specifies the default value.

Status Option

The status option lists this information:

ID

Port number of the server, in decimal.

T

Type of server:

s

Sends (output) server

r

Receives (input) server

Pipe

Pipe name.

Host

Host name (input server only).

Port

Socket port number in decimal.

S

Status of the server:

e

Error

c

Completed

l

Logoff

q

Queued

r

Running

s

Aborted

Time

Time of the last trace entry.

Date

Date of the last trace entry.

Message

Trace Message. Each trace is prefixed by the current message number in decimal. The servers exchange message number information to make sure no data loss occurs. These are the main messages:

ack timeout

Input server did not respond to a message. The output server retries.

accept err=n

accept() system call error. n=errno.

bad header 'x'

A network message had an incorrectly formatted header. x is a hexadecimal dump of the header.

bad msg num 'x'

A network header contained an incorrect message number x.

bind err=n

Input server could not bind with the specified port. n=errno.

broken pipe

Input server tried to write into pipe, but associated tape process detached from it.

call err=n

Output server cannot call input server. n=errno.

cannot find job-ID

Server cannot find the job-ID in the phantom log files jobs.

check err

Input server responded to a check command but found an error.

check ok

Input server responded to a check command.

clear pipe

Clear the pipe, if there is no c option.

connect accept

Input server accepted an incoming connection.

connect err=n

Output server failed to establish connection. n=errno.

hread trunc=n

Network msg header truncated. n=msg length.

listen err=n

listen() system call error. n=errno.

local query

Server responded to a tape-status query command.

lost msg=n

Input server detected a message loss. n is the message received. Messages from the current message up to n are lost.

lost poll n

A transaction log test item has not been received by the Input server.

malloc err=n

malloc() system call error. n=errno. Server could not obtain memory for buffers.

nread err=n

Network read error. n=errno.

nread n xxxxx

Network read. n=msg length, xxxxx trace.

nwrit err=n

Network write error. n=errno.

nwrit n xxxxx

Network write. n=msg length, xxxxx trace.

nwrit trunc=n

Network write truncated. n=msg length.

open pipe

Wait for pipe open.

pclear err=n

Error while attempting to purge the pipe. n=errno.

peof err=n

Input server failed to write a EOF marker in the pipe.

popen err=n

pen() pipe error. n=errno.

pread err=n

Pipe read error. n=errno.

pread n xxxxx

Pipe read. n=msg length, 'xxxxx' trace.

pread trunc=n

Pipe read truncated. n=msg length.

pwrit err=n

Pipe write error.n=errno.

pwrit n xxxxx

Pipe write. n=msg length, 'xxxxx' trace.

pwrit trunc=n

Pipe write truncated. n=msg length.

re-sync n

Input server receives a sync message from output server. n=new starting msg number.

send resync

Output server was asked to send a sync message.

remote shtdwn

Input server receives a request to stop.

running

Server is running. This status is stored every 5 mn on a busy system. This message is not stored in the permanent log.

sent poll

A transaction log test item has been sent to the input server.

seq error n

A message was received twice. n=old message number. The message is discarded.

started

Server is started.

stop on req

Server stopped due to a tape-socket stop command.

stop refused-txlog up

A request to stop the input server was refused because the transaction logger is still active. Repeat the stop request.

stopped

Server is stopped due to a spontaneous termination. The cause of the termination is indicated in a previous trace entry.

socket err=n

socket() system call error. n=errno.

tlog not off

Input server failed to abort the transaction restore process following a request to stop.

tlog restarted

Input server restarted the transaction restore process following a request from the remote output server.

tlog terminated

Input server aborted the transaction restore process following a request to stop.

too many disc

Server detected disconnects in excess of ndisc and terminated.

too many errors

Server detected too many errors

total on dd/mm

Total number of kilobytes transferred since the first time a message was logged the morning of the specified day.

txlog ok

Transaction log test item has been received by the input server. This message is not stored in the permanent log.

unexpected msg 'x'

Message 'x' on the network is not a tape-socket message.

unknown cmd 'x'

Server received an unknown command x.

wait ack

Output server is waiting for an acknowledgement.

wait connect

Input server waits for incoming call.

Query Command Result

The query command returns the running parameters and this information:

Next poll time

Time, if activated, of the next transaction log test polling

Total Data transferred

Total number of Kilobytes transferred that day. This is an approximate number.

Last msgnum

Last message number, at the time of the last query and the average number of messages per second since the last query. This count does not include the protocol message.

msgin

Total number of messages input to the server. For an input server, this is the number of network messages, including the protocol messages. For an output server, this is the number of tape blocks read from the pipe.

msgout

Total number of messages output from the server. For an input server, this is the number of tape blocks written into the pipe. For an output server, this is the number of messages sent on the network, including the protocol messages.

curmsg

Current message number. During normal operations, the values of curmsg for both servers should be equal. Should they diverge, the input server logs the incident and resynchronizes.

Status

Short description of the server’s current status:

Open pipe

Server is waiting for the associated tape process to open the pipe. This is the quiescent state of both servers when no tape process has opened the associated pipe.

Reading network

Input server is waiting for incoming data from the network. This is the quiescent state of the input server.

Reading pipe

Output server is waiting for data from the associated tape process. This is the quiescent state of the output server.

Wait 1st call

Output server is waiting for the answer to its first call to establish connection. Wait for incoming connect. The input server is waiting for an incoming call.

Wait subsequent call

Output server is waiting for the answer to repeated calls to establish connection. This is an indication of failure to establish communication with the input server.

Stopped

Server is stopped.

Drain Command

The drain command empties the specified pipe. This command is implicitly executed when starting a server, unless the c option is specified or if the server is linked to the transaction logger. Emptying the pipe is sometimes necessary to resynchronize the processes. The data, which is drained out, is saved in the file ts.log,backup for later processing.

Check Command

The check command is used to send requests from the local output server to the remote input server. The main purpose is to check the communication link and to do some remote control of the input server. The chk.com command is executed by the remote input Server. If there is more than one word, it must be enclosed in single quotation marks (for example, cmd=’exec where 0 (h’):

exec tcl.com

Executes the TCL command tcl.com on the remote. This command such as who or time. Only the first line of the result is returned.

msgnum

Returns the last message number received by the input server.

query

Queries the remote input server for its status.

shtdwn

Shuts down input server. The input server terminates immediately. If it is linked to the transaction logger subsystem, the transaction restore process is aborted and sent back the tape-socket menu.

test -f fn

Tests if the file fn exists. If so, a string "1 File 'fn' exists" is sent back. If not, a string "0 File 'fn' missing" is sent back.

test -r{d} fn ID

Tests if the file fn exists and if the item-ID is in this file. If so, a string "1 <item body>" is sent back. If not, a string "0 File 'fn' missing" or "0 Item 'ID' missing" is sent back. If the d flag is present, the item is deleted.

tlchk

Checks the transaction restore on the backup system. Valid only if the input server is linked to the transaction logger subsystem. This command makes sure the process doing the transaction restore is in a normal state (attached to the tape, not waiting for input, not in the debugger, and so on), and makes an attempt at correcting the problem (answering to the prompts). This command is executed automatically by the output server when a transaction log polling test fails, and by the input server if it displays that the transaction restore is not emptying the pipe.

tlstrt

Restarts the transaction restore on the backup system. Valid only if the input server is linked to the transaction logger subsystem.

tron n

Turns traces on the remote and n is the number of traces.

troff

Turns traces off on the remote.

System Administrator Messages

This lists the messages that can be sent to the D3 users designated in the notify parameter, the likely cause and the possible actions to correct the situation:

Communication to host is reestablished.

Indicates the output server succeeded in reestablishing the connection. This message is issued only once.

Input Server stopped due to an error.

Indicates the server encountered a fatal error. Use the Status command on the receiver’s side to find the last error. This is likely to be due to a serious condition like, the UNIX pipe does not exist, or does not have the proper access rights, the TCP port number is already in use, and so on.

Network Back On Line.

Indicates after a network error was detected, the communication was reestablished. This message is sent only once, to indicate the end of a problem.

Network Error. Check Error Log.

Indicates a network error was detected. Check the error log to see the cause of the failure. Check if the input server is up. Use the UNIX command ping <host> to verify the remote host can be reached. This message is sent only once, the first time an error is detected.

Network is disconnected. Retrying to call host.

Indicates the output server failed to establish or reestablish the connection after three attempts. This message is issued only once. Check the error log to see the cause of the failure. Check the input server is up. Use the UNIX command ping <host> to verify the remote host can be reached.

Output Server stopped due to an error.

Indicates the server encountered a fatal error. Use the Status option to find the last error.

Transaction logger problem. Test item not sent.

Indicates the output server found that none of the transaction log test items reached the remote system. Make sure the communication is up and that the enqueueing of transactions is active. If the transaction log queue is large, it may be because the test items are still in it. If the queue is empty or small, check the transaction logger with the TCL command txlog. This message is likely to be an indication of a serious problem. This message is issued at every failed attempt until a test succeeds. If this becomes a nuisance, change the polling period, using the menu option Change TX LOG Polling, in the Special Operations submenu.

Transaction logger problem. Lost poll.

Indicates the output server found that one of the transaction log test items did not reach the remote system, even though some test items made it on the other system. This is likely to be a temporary condition, due to a large queue. This message is issued at every failed attempt until a test succeeds. If this becomes a nuisance, change the polling period, using the menu option Change TX LOG Polling, in the Special Operations submenu.

Transaction log back on line.

Indicates the transaction log test polling resumed its normal operations after an incident was discovered in a previous test. This message is issued only once to indicate the end of the problem.

Transaction logger not attached to tape

Indicates that the transaction logger was detached from the tape without the output server being notified. This was probably caused by using the transaction log menu instead of the tape-socket stop command or menu option. Stop the output server and restart it to correct this situation.

Transaction Restore not Restarted on Receiver.

Indicates that the input server failed to restart the transaction restore. The process doing the Transaction Restore on the receiver is probably waiting for a user prompt due, most likely, to the stopping of the transaction logger by a means other than the tape-socket menu or command. If the tape has been detached manually from the transaction logger, which can be displayed by the txlog command, it might be possible to restart the transaction logger from the master system, by selecting the option Send Command to Remote in the submenu Special Operations, and send the command tlstrt, which instructs the input server to restart the transaction restore. If this remote command succeeds, then reattach the tape to the transaction logger on the sender side by using the transaction log menu. If this fails, the system administrator must act on the receiver’s side, by answering whatever question is asked on the transaction restore process (for example, Mount Next reel, or end if an abort occurred, and so on). Then, restart the input server. The pipe might have to be drained on the receiver’s side, using the Drain Pipe option in the Special Operations submenu.

Transaction Restore problem. diagnostics

Indicates that the Transaction Restore, on the receiving side, is in an abnormal state. This message is issued by the output server when, after having detected that a transaction polling test failed, an attempt at correcting the situation failed. This situation probably requires the system administrator to intervene on the backup system (or use the remote command execution to act on the transaction restore).

Default Server Menus

Without any option, a menu displays. This menu allows operations on the default server. All optional arguments are set to their defaults, when using the menu. This should suit most configurations where there is only one server, either input or output. When an argument is missing, the user is prompted for it.

Network Tape (1.5.15)

1) List Status 4) Stop Server 7) Show Server

2) Query Server 5) Special Operations 8) Shutdown

3) Start Server 6) Setup Server 9) Other Servers

The Special Operations submenu allows performing seldom used operations, for example, to test a new installation.

Network Tape (1.5.15) : Special Operations

1) Turn Trace ON on Server 7) Start Server with NO clear

2) Turn Trace OFF on Server 8) List Permanent Log

3) Change TX LOG polling 9) Clear Permanent Log

4) Change notify user 10) Test transaction Log

5) Drain Pipe 11) List pipes

6) Send Command to Remote

Each option in the menu has some online help.

Hot Backup Setup

Assume a TCP/IP configuration over Ethernet, between two systems. The sender is the production system prod and the receiver a backup system backup. The two systems are to be set up in a hot backup configuration. Both systems are defined in the UNIX /etc/hosts/ file.

To perform a hot backup setup:

  1. Create a pipe (from UNIX) by typing:

  2. mknod /dev/tapein p

    chmod a+rw /dev/tapein

  3. Declare the pipe as a pseudo tape in the D3 configuration file of the receiver, by typing the statement:

  4. tape /dev/tapein 500 c lx

  5. Boot the D3 virtual machine on the backup system. You must have at least two terminals connected to the backup systems. One is used for the transaction restore, and the second one is used, temporarily, for system administration.

  6. Select an unused TCP port number. The list of currently used port numbers can be found, usually, in the UNIX file /etc/services, or by using the netstat -a command. The number can be anything (>1024 and <32767), as long as both servers agree on it. This example uses 3000.

  7. Set the default Server by selecting the option Setup Server in the menu. Type:

  8. Server type : in

    TCP/IP port number : 3000

    Protocol : inet

    UNIX pipe name : /dev/tapein

    D3 User to notify : bob

    Start transaction logger : on

  9. Start the input server on backup by selecting the option Start Server, or type:

  10. tape-socket start

    ’PROD’ setup:

  11. Create a pipe (from UNIX) by typing:

  12. mknod /dev/tapeout p

    chmod a+rw /dev/tapeout

  13. Declare the pipe as a pseudo tape in the D3 configuration file of the sender by typing:

  14. tape /dev/tapeout 500 c lx

  15. Boot the D3 virtual machine on the prod system.

  16. Set the default server by selecting the option Setup Server in the menu by typing:

  17. Server type : out

    Remote HOST name : BACKUP

    TCP/IP port number : 3000

    Protocol : inet

    UNIX pipe name : /dev/tapeout

    D3 User to notify : bob

    Transaction Log test polling : 00:10:00

    Start transaction logger : on

    Log (DL) files or ALL : dl

    Transaction log queue period : 3

  18. Start the output server on prod by selecting the option Start Server, or by typing:

  19. On both systems, list the server activity by selecting the option List Status. Both servers should show a status Started. Query the servers by selecting option Query Server. The output server should show a status Reading Pipe and the input server should show a status Reading Network.

To check if the remote input server is active:

  1. Select the Special Operation submenu, option Send command to Remote.

  2. Type query to the question prompt cmd=, or, from TCL, use the check command. For example:

  3. tape-socket check cmd=query

    The input server responds with a short message. The check command can also be used to do some short commands on the remote input server. For example, to set the date on the remote input server enter:

    tape-socket check cmd="set-date 10/06/93"

     

    NOTE

    Quotation marks are used around the command.

To stop a server:

When attempting to stop a server, a warning is issued if the pipe served by this process is not empty. Unless absolutely required, it is not recommended to stop the server while data is in the pipe. In addition to this control, stopping the input server while the output server has not been stopped, will also issue a warning if the server has been linked to the transaction restore.

To detach the tape on the master system:

  1. Stop the transaction logger.

  2. This can be done without any human interaction on the backup system.

    NOTE

    Do not use the transaction log menu to do this.

  3. Select the tape-socket menu option Stop Server.

  4. This option detaches the tape from the transaction logger, makes the remote machine aware of the fact that the transaction logger is stopping temporarily, and stops the output server.

To reattach the tape to the transaction logger:

  1. Restart the data transfer, again.

  2. NOTE

    Do not use the transaction log menu to do this.

  3. Select the tape-socket menu option Start Server.

  4. This option restarts the output server and the transaction logger process.

To detach the Tape on the Backup System:

This operation can also be done from the master system, to make sure all operations are done in the proper order. It involves stopping the transaction logger on the master system, stopping the transaction restore on the backup system, and then stopping the Servers. All this is accomplished by the Shutdown menu option on the master system. After the remote shutdown has completed, the process which was doing the transaction restore is sent back to the tape-socket menu, after having detached the tape on the backup system. The tape can then be used.

To restart the system:

  1. Restart the input server.

  2. Remember that by starting the input server linked to the Transaction Restore, the process on which the Start Server menu option is run, becomes the process which does the transaction restore, thus not freeing the terminal.

  3. Restart the output server on the main system.

  4. NOTE

    If it is attempted to stop the input server without first stopping the output server, the input server will complain. If the stop command is repeated, then the input server stops, even if the output server is still running.

Other usages

When not linked to the transaction logger subsystem, the tape-socket servers can be used for a variety of functions. Be sure the servers are setup so that they are not linked to the transaction logger by using the Setup Server menu option.

WARNING

For UNIX: Sockets are a BSD extension which might not be available on all UNIX platforms. The current version only supports Internet Protocol (code prot=inet).

The underlying network must provide at least a transport level, such as TCP. The tape-socket command assumes the data transfer is reliable, that is, when a message is sent without error, it is assumed it was delivered properly. However, usage over a network layer can be considered, provided the NPDU size is at least 1024 bytes. The tape-socket command does not perform fragmentation. For example, even though X.25-3, strictly speaking, could not be used, the UNIX socket interface provides enough services to support tape-socket on an X.25 network.

The tape, emulated by the tape-socket protocol, has special characteristics. It has no real end-of-tape nor beginning of tape. Therefore, some utilities, such as tlog-restore, may complain about an incorrect reel number. In most cases, the user can type o to override and safely ignore the message. The permanent log is not cleared automatically. It is the system administrator’s responsibility to clear the log periodically, using the Clear Permanent Log option in the Special Operations submenu. Traces are very intrusive. Do not have traces on during normal operations.

On the receiver’s side, the tape process does not respond to the BREAK key. If it is necessary to break the receiver’s tape process, try first to stop the associated input server. When this process is stopped, it will send two file marks to the tape process, which terminates with a message such as unexpected file mark or premature end of data. This can cause a loss of data, which is to be expected since the user wants to interrupt a load operation. If it still does not stop, find the PIB on which the tape process is running and enter:

kill -int p<pib.number>

kill -hup p<pib.number>

where p, preceding the PIB number, is a prefix telling the TCL kill command that it is a D3 port number rather than a UNIX PID. The process should then either push a level or enter the system debugger. Type end.

When the output server is actively sending data, and the trace is on, it can be difficult to turn the trace back off. In fact the server is often too busy logging traces to respond even to a stop command. The tape-socket-menu is created automatically the first time the command is run. It contains a version number. If a new version of tape-socket is run, it creates a new menu. Therefore, if the menu was customized, all changes will be lost.

Troubleshooting

When a network is involved, there is a high probability that some incident will occur. When the transaction log test polling is activated, the output server periodically attempts to write a test item in a test file and controls the item is sent to the remote server. If not, the output server complains and sends a message to the D3 user specified by the notify argument. This topic describes the potential problems that occur and the procedures to recover them. These include:

See Also

%socket() Function, Network Save/Restore, stoplog Command, Tape Socket, tlog-restore Command, Linking to the Transaction Logger Subsystem, txlog Command, txlog-status Command, update-logging Command