UPSCLI_SENDLINE(3)
π UPSCLI_SENDLINE(3) β the NUT Manual, bestie edition π
okay so welcome to UPSCLI_SENDLINE(3), part of the NUT Manual β¨ this is the one about yeeting a single command at your UPS. sit down, grab a snack π, we're doing this.
πΈ NAME πΈ
upscli_sendline, upscli_sendline_timeout, upscli_sendline_timeout_may_disconnect β send a single command to a UPS π
β¨ SYNOPSIS β¨
#include <upsclient.h>
#include <time.h> /* or <sys/time.h> on some platforms */
int upscli_sendline(UPSCONN_t *ups, const char *buf, size_t buflen);
int upscli_sendline_timeout(UPSCONN_t *ups, const char *buf, size_t buflen,
const time_t timeout);
int upscli_sendline_timeout_may_disconnect(UPSCONN_t *ups,
const char *buf, size_t buflen, const time_t timeout,
int may_disconnect);
note the little header situation:<time.h>is the vibe, but some platforms want<sys/time.h>instead. iykyk π
π¦ DESCRIPTION π¦
so upscli_sendline() and upscli_sendline_timeout() take a pointer ups to a UPSCONN_t state structure, and they transmit a buffer buf of size buflen over to the server. that's it, that's the whole job π«Ά
and likeβ¦ the data in buf has to be a fully formatted protocol command, because literally no parsing of the buffer happens inside these functions. zero. none. you hand it a whole command or you hand it nothing, bestie π
now here's the tea on the three of them β the difference is all about timeouts and disconnecting:
upscli_sendline_timeout()lets the caller decide the amount of time βtimeoutseconds β after which it should give up and return. main character energy, you're in charge πupscli_sendline()does not offer this freedom, and uses an immediate timeout (0 second). no negotiation π- both of those disconnect upon errors. no cap. π
upscli_sendline_timeout_may_disconnect()further allows you to enable or disable such disconnections, thanks tomay_disconnect. your call, your rules β¨
π RETURN VALUE π
upscli_sendline() and upscli_sendline_timeout() return 0 on success, or -1 if an error occurs. that's the whole vibe check: 0 slay, -1 not slay π₯
π SEE ALSO π
upscli_fd(3)upscli_get(3)upscli_readline(3)upscli_sendline(3)upscli_ssl(3)upscli_strerror(3)upscli_upserror(3)
and that's the page!! π this was Network UPS Tools 2.8.5, dated 10/07/2026, filed under UPSCLI_SENDLINE(3) in the NUT Manual. go forth and send your lines, you absolute icon πβ¨ππ¦
π¦ where this page comes from
- fedora 43: nut-devel 2.8.5-9.fc43 Β· GPL-2.0-or-later AND GPL-3.0-or-later
- fedora 43: nut-devel 2.8.5-9.fc43 Β· GPL-2.0-or-later AND GPL-3.0-or-later
- fedora 44: nut-devel 2.8.5-9.fc44 Β· GPL-2.0-or-later AND GPL-3.0-or-later
- fedora 44: nut-devel 2.8.5-9.fc44 Β· GPL-2.0-or-later AND GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms