@item
Or it can be also run as a @command{daemontools} daemon under
- @url{http://cr.yp.to/ucspi-tcp.html, UCSPI-TCP}:
+ @url{http://cr.yp.to/ucspi-tcp.html, UCSPI-TCP}. In the example
+ below it uses native daemontools's logging capability:
@example
# mkdir -p /var/service/.nncp-daemon/log
# cat > run <<EOF
#!/bin/sh -e
-exec envuidgid nncpuser tcpserver -DHRU -l 0 ::0 uucp \
- /usr/local/bin/nncp-daemon -quiet -ucspi
+NNCPLOG=FD:4 exec envuidgid nncpuser tcpserver -DHRU -l 0 ::0 uucp \
+ /usr/local/bin/nncp-daemon -quiet -ucspi 4>&1
EOF
# cat > log/run <<EOF
#!/bin/sh -e
-exec setuidgid uucp multilog t ./main
+exec setuidgid uucp multilog ./main
EOF
# chmod -R 755 /var/service/.nncp-daemon
@item spool
Absolute path to the @ref{Spool, spool} directory.
@item log
-Absolute path to the @ref{Log, log} file.
+Either:
+ @itemize
+ @item absolute path to the @ref{Log, log} file
+ @item @code{FD:XXX}, where @code{XXX} is a decimal file descriptor
+ to write records too
+ @end itemize
@item umask
Will force all invoked commands to override their umask to specified
octal mask. Useful for using with @ref{Shared spool, shared spool directories}.
read by human, but it is better to use either @ref{nncp-log}, or
@command{recutils} utilities for selecting and formatting the required
fields.
+
+Two example records from it:
+
+@verbatim
+When: 2021-08-07T20:30:49.042460622Z
+Who: sp-file-done
+Node: BYRRQUULEHINPKEFN7CHMSHR5I5CK7PMX5HQNCYERTBAR4BOCG6Q
+Nice: 255
+Type: file
+XX: rx
+Pkt: VQFR6KXC5N4UGL3HKKJKPXE4TN3G4UQGFXQTEYFZ7ZZIKWUVKOGA
+Size: 5229
+FullSize: 5229
+Msg: Got packet VQFR6KXC5N4UGL3HKKJKPXE4TN3G4UQGFXQTEYFZ7ZZIKWUVKOGA 100% (5.1 KiB / 5.1 KiB): done
+
+When: 2021-08-07T20:30:49.131766306Z
+Who: rx
+Node: BYRRQUULEHINPKEFN7CHMSHR5I5CK7PMX5HQNCYERTBAR4BOCG6Q
+Pkt: VQFR6KXC5N4UGL3HKKJKPXE4TN3G4UQGFXQTEYFZ7ZZIKWUVKOGA
+Nice: 96
+Size: 4741
+Type: exec
+Dst: sendmail stargrave@stargrave.org
+Msg: Got exec from gw to sendmail stargrave@stargrave.org (4.6 KiB)
+@end verbatim
@node Новости
@section Новости
+@node Релиз 7.6.0
+@subsection Релиз 7.6.0
+@itemize
+
+@item
+Журналирование может производиться в назначенный открытый файловый
+дескриптор (@env{$NNCPLOG=FD:5} например).
+Что дружелюбно к использованию под @command{daemontools}.
+
+@end itemize
+
@node Релиз 7.5.1
@subsection Релиз 7.5.1
@itemize
See also this page @ref{Новости, on russian}.
+@node Release 7_6_0
+@section Release 7.6.0
+@itemize
+
+@item
+Logging may be done to specified opened file descriptor
+(@env{$NNCPLOG=FD:5} for example).
+That is friendly to use under @command{daemontools}.
+
+@end itemize
+
@node Release 7_5_1
@section Release 7.5.1
@itemize
PORTNAME= nncp
-DISTVERSION= 7.4.0
+DISTVERSION= 7.6.0
CATEGORIES= net
MASTER_SITES= http://www.nncpgo.org/download/
"io/ioutil"
"os"
"path/filepath"
+ "strconv"
+ "strings"
"syscall"
)
} else {
ctx.LogPath = logPath
}
+ if strings.HasPrefix(ctx.LogPath, LogFdPrefix) {
+ ptr, err := strconv.ParseUint(
+ strings.TrimPrefix(ctx.LogPath, LogFdPrefix), 10, 64,
+ )
+ if err != nil {
+ return nil, err
+ }
+ LogFd = os.NewFile(uintptr(ptr), CfgLogEnv)
+ if LogFd == nil {
+ return nil, errors.New("can not open:" + ctx.LogPath)
+ }
+ }
if showPrgrs {
ctx.ShowPrgrs = true
}
"golang.org/x/sys/unix"
)
+const LogFdPrefix = "FD:"
+
+var LogFd *os.File
+
type LE struct {
K string
V interface{}
}
func (ctx *Ctx) Log(rec string) {
+ if LogFd != nil {
+ LogFd.WriteString(rec)
+ return
+ }
fdLock, err := os.OpenFile(
ctx.LogPath+".lock",
os.O_CREATE|os.O_WRONLY,
const Base32Encoded32Len = 52
var (
- Version string = "7.5.1"
+ Version string = "7.6.0"
Base32Codec *base32.Encoding = base32.StdEncoding.WithPadding(base32.NoPadding)
)