SYSTEMD-SOCKET-ACTIVATE(1)
๐ SYSTEMD-SOCKET-ACTIVATE ๐
okay bestie, welcome to the systemd-socket-activate page, manual section 1, and it is literally the cutest little testing tool in the whole systemd friend group ๐ซถ
โจ NAME โจ
systemd-socket-activate โ test socket activation of daemons. yeah. that's the whole vibe. ๐
๐ธ SYNOPSIS ๐ธ
systemd-socket-activate [OPTIONS...] COMMAND [ARGS...]
๐ฆ DESCRIPTION ๐ฆ
so like, systemd-socket-activate is what you use when you wanna launch a socket-activated service program straight from the command line, just for testing purposes. no unit files, no drama, just vibes. ๐ง
it can also launch individual instances of the service program, one per connection. yes ma'am, per connection. iconic behavior.
the daemon you wanna launch โ and its options โ go after the options that belong to systemd-socket-activate itself. don't mix them up bestie, the ordering is the whole thing. ๐ญ
if you pass the --inetd option, the socket file descriptor gets used as the standard input and output of the launched process. if you don't, then standard input and output just get inherited like normal, and sockets come through file descriptors 3 and higher. sockets that got passed to systemd-socket-activate through $LISTEN_FDS get passed on through to the daemon in the original positions. other sockets you specified with --listen= will use consecutive descriptors instead. and by default? systemd-socket-activate listens on a stream socket. if you want datagram or sequential packet sockets instead, that's what --datagram and --seqpacket are for (more on those below ๐).
โจ OPTIONS โจ
-laddress,--listen=address โ listen on this address. takes a string like"2000"or"127.0.0.1:2001". Added in version 230.-a,--acceptโ launch an instance of the service program for each connection, and pass the connection socket. โ ๏ธ may not be combined with--now. Added in version 230.-d,--datagramโ listen on a datagram socket (SOCK_DGRAM) instead of a stream socket (SOCK_STREAM). โ ๏ธ may not be combined with--seqpacket. Added in version 230.--seqpacketโ listen on a sequential packet socket (SOCK_SEQPACKET) instead of a stream socket (SOCK_STREAM). โ ๏ธ may not be combined with--datagram. Added in version 230.--inetdโ use the inetd protocol for passing file descriptors, meaning as standard input and standard output, instead of the new-style protocol that passes file descriptors using$LISTEN_FDS(see above ๐). Added in version 230.-EVAR[=VALUE],--setenv=VAR[=VALUE]โ add this variable to the environment of the launched process. if VAR is followed by"=", then assume it's a variableโvalue pair. otherwise, grab the value from the environment ofsystemd-socket-activateitself. Added in version 230.--fdname=NAME[:NAME...]โ specify names for the file descriptors being passed. this is equivalent to settingFileDescriptorName=in socket unit files, and it enables use ofsd_listen_fds_with_names(3). multiple entries may be specified using separate options, or by separating names with colons (":") in one option. if you give more names than descriptors, the extra ones just get ignored ๐. if you give fewer names than descriptors, the remaining file descriptors stay unnamed. Added in version 230.--nowโ start the service program instantly, instead of waiting for a connection on the socket(s). โ ๏ธ may not be combined with--accept. Added in version 258.-h,--helpโ print a short help text and exit. ๐ซก Added in version 230.--versionโ print a short version string and exit. Added in version 230.
๐ ENVIRONMENT VARIABLES ๐
$LISTEN_FDS,$LISTEN_PID,$LISTEN_PIDFDID,$LISTEN_FDNAMESโ seesd_listen_fds(3). Added in version 230.$SYSTEMD_LOG_TARGET,$SYSTEMD_LOG_LEVEL,$SYSTEMD_LOG_TIME,$SYSTEMD_LOG_COLOR,$SYSTEMD_LOG_LOCATIONโ same as insystemd(1). Added in version 230.
๐ EXAMPLES ๐
Example 1. Run an echo server on port 2000
$ systemd-socket-activate -l 2000 --inetd -a cat
Example 2. Run a socket-activated instance of systemd-journal-gatewayd(8)
$ systemd-socket-activate -l 19531 /usr/lib/systemd/systemd-journal-gatewayd
๐ SEE ALSO ๐
systemd(1), systemd.socket(5), systemd.service(5), systemd-run(1), sd_listen_fds(3), sd_listen_fds_with_names(3), cat(1)
okay that's the whole page bestie, you ate that ๐
โจ this was systemd 262.1, manual page SYSTEMD-SOCKET-ACTIVATE(1) โ now go socket-activate something and make it everyone's problem ๐ฆ๐
๐ฆ where this page comes from
- arch rolling: systemd 262.1-1 ยท LGPL-2.1-or-later AND CC0-1.0 AND GPL-2.0-or-later AND MIT-0
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms