]> gitweb.michael.orlitzky.com - dead/htsn.git/blob - doc/man1/htsn.1
9d7ebce607b170f8ce220a914149313275fae737
[dead/htsn.git] / doc / man1 / htsn.1
1 .TH htsn 1
2
3 .SH NAME
4 htsn \- Parse XML files from The Sports Network feed.
5
6 .SH SYNOPSIS
7
8 \fBhtsn\fR [OPTIONS] [HOSTNAMES]
9
10 .SH DESCRIPTION
11 .P
12 The Sports Network <http://www.sportsnetwork.com/> offers an XML feed
13 containing various sports news and statistics. The goal of \fBhtsn\fR
14 is to watch the XML feed and parse the individual XML documents into
15 files.
16 .P
17 Once started, we will choose an XML feed host to connect to. The
18 choice is made from a list in a round-robin fashion, and by default,
19 the list contains all known TSN feed hosts. Once we have a connection,
20 your username and password are sent. If they are accepted, we begin to
21 parse the feed saving all XML files to the configured output directory
22 (see \fI\-\-output\-directory\fR).
23 .P
24 If we encounter an error (say, the connection is dropped), then we
25 will attempt to connect to the next host in the list after waiting
26 five seconds. This process continues indefinitely.
27 .P
28 The program can run either interactively (that is, outputting to the
29 console), or as a daemon with the \fI\-\-daemonize\fR flag.
30
31 .SH INPUT
32 .P
33 The program takes no input; a username and password must be supplied
34 on the command-line or in a configuration file.
35
36 .SH OUTPUT
37 .P
38 Output is not generated when running as a daemon; otherwise, standard
39 out and standard error are fairly noisy. All traffic between htsn and
40 the feed server is displayed on stdout. Status messages are
41 interspersed when they are generated with warnings and errors going to
42 stderr. The following can be expected:
43 .IP \[bu] 2
44 The only data we send to the feed are the username and password. These
45 will be highlighted in green on stdout.
46 .IP \[bu]
47 All data received from the feed will be echoed in the default color to
48 stdout.
49 .IP \[bu]
50 Informational messages will be highlighted in cyan and sent to stdout.
51 .IP \[bu]
52 Warnings will be highlighted in yellow and sent to stderr.
53 .IP \[bu]
54 Errors will be highlighted in red and sent to stderr.
55
56 .SH LOGGING
57 .P
58 Logging is done either to syslog or a file. The destination and
59 verbosity are controlled by the \fI\-\-log\-file\fR,
60 \fI\-\-log\-level\fR, and \fI\-\-syslog\fR parameters which may be
61 specified either on the command line or in the configuration file.
62
63 .SH OPTIONS
64
65 .IP \fB\-\-daemonize\fR,\ \fB\-d\fR
66 Run as a daemon, in the background. When running as a daemon the
67 \fI\-\-pidfile\fR, \fI\-\-run\-as\-group\fR, and
68 \fI\-\-run\-as\-user\fR flags become relevant.
69
70 Default: disabled
71
72 .IP \fB\-\-log-file\fR
73 If you specify a file here, logs will be written to it (possibly in
74 addition to syslog). Can be either a relative or absolute path. It
75 will not be auto-rotated; use something log logrotate for that.
76
77 Default: none
78
79 .IP \fB\-\-log-level\fR
80 How verbose should the logs be? We log notifications at three levels:
81 INFO, WARN, and ERROR. Specify the \(dqmost boring\(dq level of
82 notifications you would like to receive (in all-caps); more
83 interesting notifications will be logged as well.
84
85 Default: INFO
86
87 .IP \fB\-\-output\-directory\fR,\ \fB\-o\fR
88 To which directory should we write the XML files?
89
90 Default: .
91
92 .IP \fB\-\-password\fR
93 The password associated with your TSN username. A password is
94 required, so you must supply one either on the command line or in a
95 configuration file.
96
97 Default: none
98
99 .IP \fB\-\-pidfile\fR
100 (Daemon mode only) Create a PID file in the given location. This is
101 used by the init system on Unix to keep track of the running daemon.
102 Its parent directory must be writable by the user/group that we will
103 run as!
104
105 Default: /run/htsn/htsn.pid
106
107 .IP \fB\-\-run\-as\-group\fR
108 (Daemon mode only) Run as the given system group. The PID file is
109 written before privileges are dropped, so the only privileges needed
110 by htsn are those necessary to write the XML files and (optionally)
111 the log file.
112
113 Default: the current group
114
115 .IP \fB\-\-run\-as\-user\fR
116 (Daemon mode only) Run as the given system user. The PID file is
117 written before privileges are dropped, so the only privileges needed
118 by htsn are those necessary to write the XML files and (optionally)
119 the log file.
120
121 Default: the current user
122
123 .IP \fB\-\-syslog\fR,\ \fB\-s\fR
124 Enable logging to syslog. On Windows this will attempt to communicate
125 (over UDP) with a syslog daemon on localhost, which will most likely
126 not work.
127
128 Default: disabled
129
130 .IP \fB\-\-username\fR,\ \fB\-u\fR
131 Your TSN username. A username is required, so you must supply one
132 either on the command line or in a configuration file.
133
134 Default: none
135
136 .SH FEED HOSTS
137 .P
138 It is possible to pass a list of feed hostnames on the command-line
139 (see [HOSTNAMES] in the synopsis). By default \fBhtsn\fR will attempt
140 to connect to every known TSN XML feed host in a round-robin fashion,
141 so there is rarely a need to do this.
142
143 .SH CONFIGURATION FILE
144 .P
145 Any of the command-line options mentioned above can be specified in a
146 configuration file instead. We first look for \(dqhtsnrc\(dq in the
147 system configuration directory. We then look for a file named
148 \(dq.htsnrc\(dq in the user's home directory. The latter will override
149 the former.
150 .P
151 The user's home directory is simply $HOME on Unix; on Windows its
152 wherever %APPDATA% points. The system configuration directory is
153 determined by Cabal; the \(dqsysconfdir\(dq parameter during the
154 \(dqconfigure\(dq step is used.
155 .P
156 The file's syntax is given by examples in the htsnrc.example file
157 (included with \fBhtsn\fR).
158 .P
159 Options specified on the command-line override those in either
160 configuration file.
161
162 .SH BUGS
163
164 .P
165 Send bugs to michael@orlitzky.com.