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 โœจ

  • -l address, --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.
  • -E VAR[=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 of systemd-socket-activate itself. Added in version 230.
  • --fdname=NAME[:NAME...] โ€” specify names for the file descriptors being passed. this is equivalent to setting FileDescriptorName= in socket unit files, and it enables use of sd_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 โ€” see sd_listen_fds(3). Added in version 230.
  • $SYSTEMD_LOG_TARGET, $SYSTEMD_LOG_LEVEL, $SYSTEMD_LOG_TIME, $SYSTEMD_LOG_COLOR, $SYSTEMD_LOG_LOCATION โ€” same as in systemd(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