1PUB(1)                                                                  PUB(1)
2
3
4

NAME

6       pub - publishes a message to an MQTT topic
7

SYNOPSIS

9       pub [OPTIONS]
10

DESCRIPTION

12       pub connects to the given MQTT broker and publishes stdin to the
13       specified topic.
14
15       All options can be passed either as command-line arguments or can be
16       specified in a simple config file.
17

OPTIONS

19       -auto-reconnect
20           automatically reconnect when connection is lost
21
22       -broker URL
23           broker address (should be in the form of a URL)
24
25       -ca-root FILE
26           path to a FILE containing CA certificates (optional)
27
28       -cert-file FILE
29           authenticate with a certificate
30
31       -clean
32           discard any pending messages from the broker (default true)
33
34       -client-id STRING
35           unique identifier for this client (defaults to a semi-random
36           string)
37
38       -connect-retry
39           automatically retry initial connection to broker
40
41       -connect-retry-interval DURATION
42           wait DURATION between initial connection attempts (default 30s)
43
44       -config FILE
45           path to FILE containing configuration values (optional)
46
47       -header KEY=VALUE
48           set an HTTP header (in KEY=VALUE form) (can be specified multiple
49           times)
50
51       -key-file FILE
52           authenticate with a private key
53
54       -password STRING
55           authenticate with a password
56
57       -qos INTEGER
58           quality of service for messages
59
60       -retained
61           retain message on the broker
62
63       -tls-alpn STRING
64           ALPN value to include in the TLS handshake (can be specified
65           multiple times)
66
67       -topic STRING
68           topic to publish or subscribe to (can be specified multiple times)
69
70       -username STRING
71           authenticate with a username
72
73       -verbose
74           increase output
75
76       -version
77           print version
78

CONFIGURATION

80       Any option may be specified as a value in a configuration file instead
81       of (or in addition to) a command-line option. Values present on the
82       command-line take precedent over values in the configration file. Thus
83       it is easy to create a base configration file that can be augmented
84       easily at run time.
85
86       The configuration file takes the form of a simple space-separated
87       "option value" format (i.e. "broker tcp://test.mosquitto.org:1883").
88

EXAMPLES

90       Publish a message to a topic anonymously.
91
92           echo "hello" | pub -broker tcp://test.mosquitto.org:1883 -topic mqttcli/pubtest
93

AUTHOR

95       Link Dupont <link@sub-pop.net>
96           Author.
97
98
99
100                                  09/28/2023                            PUB(1)
Impressum