4 htsn \- Parse XML files from The Sports Network feed.
8 \fBhtsn\fR [OPTIONS] [HOSTNAMES]
13 The Sports Network <http://www.sportsnetwork.com> offers an XML feed
14 containing various sports news and statistics. The goal of \fBhtsn\fR
15 is to watch the XML feed and parse the individual XML documents into
18 Once started, we will choose an XML feed host to connect to. The
19 choice is made from a list in a round-robin fashion, and by default,
20 the list contains all known TSN feed hosts. Once we have a connection,
21 your username and password are sent. If they are accepted, we begin to
22 parse the feed saving all XML files to the configured output directory
23 (see \fI\-\-output\-directory\fR).
25 If we encounter an error (say, the connection is dropped), then we
26 will attempt to connect to the next host in the list after waiting
27 five seconds. This process continues indefinitely.
29 The program can run either interactively (i.e. outputting to the
30 console), or as a daemon with the \fI\-\-daemonize\fR flag.
35 The program takes no input; a username and password must be supplied
36 on the command-line or in a configuration file.
41 Output is not generated when running as a daemon; otherwise, standard
42 out and standard error are fairly noisy. All traffic between htsn and
43 the feed server is displayed on stdout. Status messages are
44 interspersed when they are generated with warnings and errors going to
45 stderr. The following can be expected:
47 The only data we send to the feed are the username and password. These
48 will be highlighted in green on stdout.
50 All data received from the feed will be echoed in the default color to
53 Informational messages will be highlighted in cyan and sent to stdout.
55 Warnings will be highlighted in yellow and sent to stderr.
57 Errors will be highlighted in red and sent to stderr.
61 Logging is done either to syslog or a file. The destination and
62 verbosity are controlled by the \fI\-\-log_file\fR,
63 \fI\-\-log_level\fR, and \fI\-\-syslog\fR parameters which may be
64 specified either on the command line or in the configuration file.
68 .IP \fB\-\-daemonize\fR
69 Run as a daemon, in the background. When running as a daemon the
70 \fI\-\-pidfile\fR, \fI\-\-run\-as\-group\fR, and
71 \fI\-\-run\-as\-user\fR flags become relevant.
75 .IP \fB\-\-log-file\fR
76 If you specify a file here, logs will be written to it (possibly in
77 addition to syslog). Can be either a relative or absolute path. It
78 will not be auto-rotated; use something log logrotate for that.
82 .IP \fB\-\-log-level\fR
83 How verbose should the logs be? We log notifications at three levels:
84 INFO, WARN, and ERROR. Specify the \(dqmost boring\(dq level of
85 notifications you would like to receive (in all-caps); more
86 interesting notifications will be logged as well.
90 .IP \fB\-\-output\-directory\fR,\ \fB\-o\fR
91 To which directory should we write the XML files?
95 .IP \fB\-\-password\fR
96 The password associated with your TSN username. A password is
97 required, so you must supply one either on the command line or in a
102 .IP \fB\-\-pidfile\fR
103 (Daemon mode only) Create a PID file in the given location. This is
104 used by the init system on Unix to keep track of the running daemon.
106 Default: /run/htsn.pid
108 .IP \fB\-\-run\-as\-group\fR
109 (Daemon mode only) Run as the given system group. The PID file is
110 written before privileges are dropped, so the only privileges needed
111 by htsn are those necessary to write the XML files and (optionally)
114 Default: the current group
116 .IP \fB\-\-run\-as\-user\fR
117 (Daemon mode only) Run as the given system user. The PID file is
118 written before privileges are dropped, so the only privileges needed
119 by htsn are those necessary to write the XML files and (optionally)
122 Default: the current user
124 .IP \fB\-\-syslog\fR,\ \fB\-s\fR
125 Enable logging to syslog. On Windows this will attempt to communicate
126 (over UDP) with a syslog daemon on localhost, which will most likely
131 .IP \fB\-\-username\fR,\ \fB\-u\fR
132 Your TSN username. A username is required, so you must supply one
133 either on the command line or in a configuration file.
139 It is possible to pass a list of feed hostnames on the command-line
140 (see [HOSTNAMES] in the synopsis). By default \fBhtsn\fR will attempt
141 to connect to every known TSN XML feed host in a round-robin fashion,
142 so there is rarely a need to do this.
147 Send bugs to michael@orlitzky.com.