NAME

rwsender - Watch directory for files and transfer them to rwreceiver(s)

SYNOPSIS

  rwsender --mode=server --server-port=[HOST:]PORT
        --client-ident=IDENT [--client-ident=IDENT ...]
        --identifier=IDENT --incoming-directory=DIR
        [ --tls-ca=PEM_FILE
          { { --tls-cert=PEM_FILE --tls-key=PEM_FILE }
            | --tls-pkcs12=DER_FILE } ]
        --processing-directory=DIR --error-directory=DIR
        [--local-directory=[[IDENT]:]DIR
          [--local-directory=[[IDENT]:]DIR ...]]
        [--unique-local-copies]
        [--filter=IDENT:REGEXP] [--priority=NUM:REGEXP]
        [--polling-interval=NUM]
        [--send-attempts=NUM] [--block-size=NUM]
        { --log-destination=DESTINATION
          | --log-pathname=FILE_PATH
          | --log-directory=DIR_PATH [--log-basename=LOG_BASENAME]
            [--log-post-rotate=COMMAND] }
        [--log-level=LEVEL] [--log-sysfacility=NUMBER]
        [--pidfile=FILE_PATH] [--no-chdir] [--no-daemon]

  rwsender --mode=client --server-address=IDENT:HOST:PORT
        [--server-address=IDENT:HOST:PORT ...]
        --identifier=IDENT --incoming-directory=DIR
        [ --tls-ca=PEM_FILE
          { { --tls-cert=PEM_FILE --tls-key=PEM_FILE }
            | --tls-pkcs12=DER_FILE } ]
        --processing-directory=DIR --error-directory=DIR
        [--local-directory=[[IDENT]:]DIR
          [--local-directory=[[IDENT]:]DIR ...]]
        [--unique-local-copies]
        [--filter=IDENT:REGEXP] [--priority=NUM:REGEXP]
        [--polling-interval=NUM]
        [--send-attempts=NUM] [--block-size=NUM]
        { --log-destination=DESTINATION
          | --log-pathname=FILE_PATH
          | --log-directory=DIR_PATH [--log-basename=LOG_BASENAME]
            [--log-post-rotate=COMMAND] }
        [--log-level=LEVEL] [--log-sysfacility=NUMBER]
        [--pidfile=FILE_PATH] [--no-chdir] [--no-daemon]

  rwsender --help

  rwsender --version

DESCRIPTION

rwsender is a daemon which watches an incoming directory for files. When files are added, they are moved into a processing directory and then transferred over the network to one or more rwreceiver(8) processes.

Any file in the incoming directory whose size is 0 bytes or whose name begins with a dot . is ignored.

Either rwsender or rwreceiver may act as the server with the other acting as the client. That is, an rwsender server may listen for connections from rwreceiver clients, or an rwsender client may attempt to connect to one or more rwreceiver servers.

In addition, each rwsender and rwreceiver is configured with an identifier of its own and the identifier(s) of the rwreceiver(s) or rwsender(s) that may connect to it. The connection will not established if the identifier provided by other process is not recognized.

Every rwsender that communicates with the same rwreceiver must have a unique identifier; likewise, every rwreceiver that communicates with the same rwsender must have a unique identifier. Ideally, the identifier should provide some information about where the rwsender or rwreceiver program is running and what sort of data it is transferring.

OPTIONS

Option names may be abbreviated if the abbreviation is unique or is an exact match for an option. A parameter to an option may be specified as --arg=param or --arg param, though the first form is required for options that take optional parameters.

The following set of switches are required:

--identifier=IDENT

Use the name IDENT when establishing a connection with an rwreceiver process. The identifier should contain only printable, non-whitespace characters; the following characters are illegal: colon (:), slash (/ and \), period (.), and comma (,).

--mode=MODE

Specify how the connection between rwsender and rwreceiver(s) should be established. When MODE is server, rwsender will listen for connections from rwreceiver clients; when MODE is client, rwsender will attempt to connect to rwreceiver servers.

--incoming-directory=DIR

Watch the directory DIR for files to transfer. rwsender ignores any files in this directory that are empty or whose names begin with a dot (.). In addition, new files will only be considered when their size is constant for one polling-interval after they are first noticed.

--processing-directory=DIR

Use DIR as a location to cache files until they are successfully transferred. For each rwreceiver IDENT specified on the command line, a subdirectory is created under DIR to hold a copy of each file that is to be sent to that rwreceiver. (rwsender uses a reference (a hard link) to the file instead of a copy of the file when possible.)

--error-directory=DIR

Move a file that is rejected by an rwreceiver (for example, because it has a duplicate filename) to the subdirectory IDENT of DIR, where IDENT is the identifier of the rwreceiver that rejected the file.

When running in server mode, the following switches are required:

--server-port=[HOST:]PORT

Listen for incoming rwreceiver client connections on PORT as HOST. If HOST is omitted, rwsender will listen on any address. HOST may be name or an IP address; when HOST is an IPv6 address, enclose it in square brackets.

--client-ident=IDENT

Allow connections from an rwreceiver client whose identifier is IDENT. This switch may be repeated to allow multiple rwreceiver clients to connect.

When running in client mode, the following switch is required:

--server-address=IDENT:HOST:PORT

Attempt to connect to the rwreceiver server listening to port number PORT on the machine HOST. The connection will be dropped unless the rwreceiver identifies itself as IDENT. This switch may be repeated to connect to multiple rwreceiver servers. HOST may be a name or an IP address; when HOST is an IPv6 address, it must be enclosed in brackets.

When SiLK is built with the GnuTLS (Transport Layer Security) library, the following switches are available. Using these switches allows rwsender and rwreceiver to use an encrypted/authenticated channel for their communication. Use GnuTLS's certtool(1) program to create the PEM (Privacy Enhanced Mail) file.

--tls-ca=PEM_FILE

Sets the Certificate Authority file to the given PEM_FILE file, thereby enabling encryption using TLS. This switch must be used in conjunction with either the --tls-pkcs12 option, or the --tls-cert and the --tls-key options.

--tls-cert=PEM_FILE

Sets rwsender's encryption certificate for TLS to the given PEM_FILE file. This switch must be used in conjunction with the --tls-ca and --tls-key options.

--tls-key=PEM_FILE

Sets rwsender's encryption key for TLS to the given PEM_FILE. This switch must be used in conjunction with the --tls-ca and --tls-cert options.

--tls-pkcs12=DER_FILE

Sets rwsender's encryption certificate and key for TLS to the given DER_FILE. This switch must be used in conjunction with the --tls-ca option. rwsender will use the value in the RWSENDER_TLS_PASSWORD environment variable to decrypt the PKCS#12 file. If this variable is not set, rwsender assumes the password is the empty string.

One of the following logging switches is required:

--log-destination=DESTINATION

Specify the destination where logging messages are written. When DESTINATION begins with a slash /, it is treated as a file system path and all log messages are written to that file; there is no log rotation. When DESTINATION does not begin with /, it must be one of the following strings:

none

Messages are not written anywhere.

stdout

Messages are written to the standard output.

stderr

Messages are written to the standard error.

syslog

Messages are written using the syslog(3) facility.

both

Messages are written to the syslog facility and to the standard error (this option is not available on all platforms).

--log-directory=DIR_PATH

Use DIR_PATH as the directory where the log files are written. DIR_PATH must be a complete directory path. The log files have the form

 DIR_PATH/LOG_BASENAME-YYYYMMDD.log

where YYYYMMDD is the current date and LOG_BASENAME is the application name or the value passed to the --log-basename switch when provided. The log files are rotated: At midnight local time, a new log is opened, the previous file is closed, and the command specified by --log-post-rotate is invoked on the previous day's log file. (Old log files are not removed by rwsender; the administrator should use another tool to remove them.) When this switch is provided, a process-ID file (PID) is also written in this directory unless the --pidfile switch is provided.

--log-pathname=FILE_PATH

Use FILE_PATH as the complete path to the log file. The log file is not rotated.

The following switches are optional:

--local-directory=[[IDENT]:]DIR

Create a duplicate of each incoming file in the directory DIR. This option may be specified multiple times to create multiple duplicates. The duplicate is made by a reference (a hard link) to the file in the processing-directory if possible, otherwise a complete copy is made. (Note that any modification-in-place to a file reference affects all references to that file; use --unique-local-copies to avoid this). If IDENT is specified, filters may be used to determine which files get copied to DIR. See --filter for filter details. When DIR contains the colon character and no IDENT is wanted, a single colon may precede DIR to designate an empty IDENT.

--unique-local-copies

Force the duplicate file created in each local-directory to be a complete copy of the file in the processing-directory instead of a reference (a hard link) to the file. Using references saves disk space and is faster than making a complete copy; however, any modification-in-place to one file affects all files. rwsender always makes a complete copy when it is unable to make a reference. This switch is ignored when the --local-directory switch is not provided.

--filter=IDENT:REGEXP

Configure rwsender to transfer files matching the regular expression REGEXP to the rwreceiver whose identifier is IDENT, or to copy files to the local directory labeled as IDENT. This switch may be repeated. When this switch is not provided, all rwreceivers and local directories get all files. When this switch is provided, any files not matching a REGEXP are left in the incoming directory and are not transferred.

The regular expression must be a POSIX 1003.2 modern or extended regular expressions, roughly akin to those used by egrep(1). Documentation might be found in the regex(7) or re_format(7) manual pages on your system.

The filter is only applied to files in the incoming-directory. Once a file has been moved into an rwreceiver-specific subdirectory of the processing-directory, restarting rwsender with a different set of --filter switches does not affect the files previously queued for each rwreceiver. To apply the filters to unsent files, you must stop the rwsender process, move all files from the subdirectories of the processing-directory to the incoming-directory, and restart the rwsender process.

--priority=NUM:REGEXP

Set the priority of files that match REGEXP to NUM. NUM must be an integer between 0 and 100 inclusive. In the current version of rwsender, priorities 0 through 50 get grouped into a single low priority bin, and priorities 51 through 100 get grouped into a single high priority bin. Files in the high priority bin are generally be sent before files in the low priority bin. The default priority of a file is 50. This switch may be repeated for multiple priorities.

--polling-interval=NUM

Configure rwsender to check the incoming directory for new files every NUM seconds. The default polling interval is 15 seconds.

--send-attempts=NUM

For each file going to an rwreceiver, make NUM attempts to open the file, map its contents, and send the contents to that rwreceiver. After NUM attempts, the file is ignored by rwsender but the file remains in the rwreceiver-specific subdirectory of the processing directory. Unless the file is manually removed from the processing directory, rwsender again attempts to send the file when rwsender is restarted. The limit may be set to a value from 1 to 65535. When NUM is 0, there is no limit. The default number of attempts is 5.

--block-size=NUM

Specify the chunk size in bytes that rwsender uses when sending files to rwreceivers. The default number of bytes is 8192; the valid range is 256 to 65535.

--log-level=LEVEL

Set the severity of messages that will be logged. The levels from most severe to least are: emerg, alert, crit, err, warning, notice, info, debug. The default is info.

--log-sysfacility=NUMBER

Set the facility that syslog(3) uses for logging messages. This switch takes a number as an argument. The default is a value that corresponds to LOG_USER on the system where rwsender is running. This switch produces an error unless --log-destination=syslog is specified.

--log-basename=LOG_BASENAME

Use LOG_BASENAME in place of the application name in the name of log files in the log directory. See the description of the --log-directory switch. This switch does not affect the name of the process-ID file.

--log-post-rotate=COMMAND

Run COMMAND on the previous day's log file after log rotation. When this switch is not specified, the previous day's log file is compressed with gzip(1). When the switch is specified and COMMAND is the empty string, no action is taken on the log file. Each occurrence of the string %s in COMMAND will be replaced with the full path to the log file, and each occurrence of %% will be replaced with %. If any other character follows %, rwsender exits with an error. Specifying this switch without also using --log-directory is an error.

--pidfile=FILE_PATH

Set the complete path to the file in which rwsender writes its process ID (PID) when it is running as a daemon. No PID file is written when --no-daemon is given. When this switch is not present, no PID file is written unless the --log-directory switch is specified, in which case the PID is written to LOGPATH/rwsender.pid.

--no-chdir

Do not change directory to the root directory. When rwsender becomes a daemon process, it changes its current directory to the root directory so as to avoid potentially running on a mounted file system. Specifying --no-chdir prevents this behavior, which may be useful during debugging. The application does not change its directory when --no-daemon is given.

--no-daemon

Force rwsender to run in the foreground---it does not become a daemon process. This may be useful during debugging.

--help

Print the available options and exit.

--version

Print the version number and information about how SiLK was configured, then exit the application.

ENVIRONMENT

RWSENDER_TLS_PASSWORD

Specifies the password to use to decrypt the PKCS#12 file specified in the --tls-pkcs12 switch.

SEE ALSO

rwreceiver(8), silk(7) syslog(3), certtool(1), egrep(1), gzip(1), regex(7), re_format(7), SiLK Installation Handbook

BUGS

An attempt should be made to use a unique name for each file put into the incoming directory. When a file is added to the incoming directory that has the same name as a file in the processing directory, the file added to the incoming directory replaces the existing file in the processing directory.