{
    "content": [
        {
            "type": "text",
            "text": "# systemd-socket-activate(1) (man)\n\n## NAME\n\nsystemd-socket-activate - Test socket activation of daemons\n\n## SYNOPSIS\n\nsystemd-socket-activate [OPTIONS...] daemon [OPTIONS...]\n\n## DESCRIPTION\n\nsystemd-socket-activate may be used to launch a socket-activated service program from the\ncommand line for testing purposes. It may also be used to launch individual instances of the\nservice program per connection.\n\n## TLDR\n\n> Socket activation for systemd services.\n\n- Activate a service when a specific socket is connected:\n  `systemd-socket-activate {{path/to/socket.service}}`\n- Activate multiple sockets for a service:\n  `systemd-socket-activate {{path/to/socket1.service}} {{path/to/socket2.service}}`\n- Pass environment variables to the service being activated:\n  `{{SYSTEMD_SOCKET_ACTIVATION=1}} systemd-socket-activate {{path/to/socket.service}}`\n- Activate a service along with a notification socket:\n  `systemd-socket-activate {{path/to/socket.socket}} {{path/to/service.service}}`\n- Activate a service with a specified port:\n  `systemd-socket-activate {{path/to/socket.service}} {{-l|--listen}} {{8080}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (8 subsections)\n- **ENVIRONMENT VARIABLES**\n- **EXAMPLES** (2 subsections)\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "systemd-socket-activate",
        "section": "1",
        "mode": "man",
        "summary": "systemd-socket-activate - Test socket activation of daemons",
        "synopsis": "systemd-socket-activate [OPTIONS...] daemon [OPTIONS...]",
        "tldr_summary": "Socket activation for systemd services.",
        "tldr_examples": [
            {
                "description": "Activate a service when a specific socket is connected",
                "command": "systemd-socket-activate {{path/to/socket.service}}"
            },
            {
                "description": "Activate multiple sockets for a service",
                "command": "systemd-socket-activate {{path/to/socket1.service}} {{path/to/socket2.service}}"
            },
            {
                "description": "Pass environment variables to the service being activated",
                "command": "{{SYSTEMD_SOCKET_ACTIVATION=1}} systemd-socket-activate {{path/to/socket.service}}"
            },
            {
                "description": "Activate a service along with a notification socket",
                "command": "systemd-socket-activate {{path/to/socket.socket}} {{path/to/service.service}}"
            },
            {
                "description": "Activate a service with a specified port",
                "command": "systemd-socket-activate {{path/to/socket.service}} {{-l|--listen}} {{8080}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-l",
                "long": null,
                "arg": null,
                "description": "Listen on this address. Takes a string like \"2000\" or \"127.0.0.1:2001\"."
            },
            {
                "flag": "-a",
                "long": "--accept",
                "arg": null,
                "description": "Launch an instance of the service program for each connection and pass the connection socket."
            },
            {
                "flag": "-d",
                "long": "--datagram",
                "arg": null,
                "description": "Listen on a datagram socket (SOCKDGRAM), instead of a stream socket (SOCKSTREAM). May not be combined with --seqpacket."
            },
            {
                "flag": "",
                "long": "--seqpacket",
                "arg": null,
                "description": "Listen on a sequential packet socket (SOCKSEQPACKET), instead of a stream socket (SOCKSTREAM). May not be combined with --datagram."
            },
            {
                "flag": "",
                "long": "--inetd",
                "arg": null,
                "description": "Use the inetd protocol for passing file descriptors, i.e. as standard input and standard output, instead of the new-style protocol for passing file descriptors using $LISTENFDS (see above)."
            },
            {
                "flag": "-E",
                "long": null,
                "arg": null,
                "description": "Add this variable to the environment of the launched process. If VAR is followed by \"=\", assume that it is a variable–value pair. Otherwise, obtain the value from the environment of systemd-socket-activate itself. --fdname=NAME[:NAME...] Specify names for the file descriptors passed. This is equivalent to setting FileDescriptorName= in socket unit files, and enables use of sdlistenfdswithnames(3). Multiple entries may be specifies using separate options or by separating names with colons (\":\") in one option. In case more names are given than descriptors, superfluous ones will be ignored. In case less names are given than descriptors, the remaining file descriptors will be unnamed."
            },
            {
                "flag": "-h",
                "long": "--help",
                "arg": null,
                "description": "Print a short help text and exit."
            },
            {
                "flag": "",
                "long": "--version",
                "arg": null,
                "description": "Print a short version string and exit."
            }
        ],
        "examples": [
            "$ systemd-socket-activate -l 2000 --inetd -a cat",
            "$ systemd-socket-activate -l 19531 /lib/systemd/systemd-journal-gatewayd"
        ],
        "see_also": [
            {
                "name": "systemd",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/systemd/1/json"
            },
            {
                "name": "systemd.socket",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/systemd.socket/5/json"
            },
            {
                "name": "systemd.service",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/systemd.service/5/json"
            },
            {
                "name": "systemd-run",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/systemd-run/1/json"
            },
            {
                "name": "sdlistenfds",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/sdlistenfds/3/json"
            },
            {
                "name": "sdlistenfdswithnames",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/sdlistenfdswithnames/3/json"
            },
            {
                "name": "cat",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/cat/1/json"
            },
            {
                "name": "SYSTEMD-SOCKET-ACTIVATE",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/SYSTEMD-SOCKET-ACTIVATE/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 15,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-l --listen=",
                        "lines": 2,
                        "flag": "-l"
                    },
                    {
                        "name": "-a --accept",
                        "lines": 3,
                        "flag": "-a",
                        "long": "--accept"
                    },
                    {
                        "name": "-d --datagram",
                        "lines": 3,
                        "flag": "-d",
                        "long": "--datagram"
                    },
                    {
                        "name": "--seqpacket",
                        "lines": 3,
                        "long": "--seqpacket"
                    },
                    {
                        "name": "--inetd",
                        "lines": 4,
                        "long": "--inetd"
                    },
                    {
                        "name": "-E --setenv=",
                        "lines": 12,
                        "flag": "-E"
                    },
                    {
                        "name": "-h --help",
                        "lines": 2,
                        "flag": "-h",
                        "long": "--help"
                    },
                    {
                        "name": "--version",
                        "lines": 2,
                        "long": "--version"
                    }
                ]
            },
            {
                "name": "ENVIRONMENT VARIABLES",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "EXAMPLES",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Example 1. Run an echo server on port 2000",
                        "lines": 2
                    },
                    {
                        "name": "Example 2. Run a socket-activated instance of systemd-journal-gatewayd(8)",
                        "lines": 2
                    }
                ]
            },
            {
                "name": "SEE ALSO",
                "lines": 6,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "systemd-socket-activate - Test socket activation of daemons\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "systemd-socket-activate [OPTIONS...] daemon [OPTIONS...]\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "systemd-socket-activate may be used to launch a socket-activated service program from the\ncommand line for testing purposes. It may also be used to launch individual instances of the\nservice program per connection.\n\nThe daemon to launch and its options should be specified after options intended for\nsystemd-socket-activate.\n\nIf the --inetd option is given, the socket file descriptor will be used as the standard input\nand output of the launched process. Otherwise, standard input and output will be inherited,\nand sockets will be passed through file descriptors 3 and higher. Sockets passed through\n$LISTENFDS to systemd-socket-activate will be passed through to the daemon, in the original\npositions. Other sockets specified with --listen= will use consecutive descriptors. By\ndefault, systemd-socket-activate listens on a stream socket, use --datagram and --seqpacket\nto listen on datagram or sequential packet sockets instead (see below).\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-l --listen=",
                        "content": "Listen on this address. Takes a string like \"2000\" or \"127.0.0.1:2001\".\n",
                        "flag": "-l"
                    },
                    {
                        "name": "-a --accept",
                        "content": "Launch an instance of the service program for each connection and pass the connection\nsocket.\n",
                        "flag": "-a",
                        "long": "--accept"
                    },
                    {
                        "name": "-d --datagram",
                        "content": "Listen on a datagram socket (SOCKDGRAM), instead of a stream socket (SOCKSTREAM). May\nnot be combined with --seqpacket.\n",
                        "flag": "-d",
                        "long": "--datagram"
                    },
                    {
                        "name": "--seqpacket",
                        "content": "Listen on a sequential packet socket (SOCKSEQPACKET), instead of a stream socket\n(SOCKSTREAM). May not be combined with --datagram.\n",
                        "long": "--seqpacket"
                    },
                    {
                        "name": "--inetd",
                        "content": "Use the inetd protocol for passing file descriptors, i.e. as standard input and standard\noutput, instead of the new-style protocol for passing file descriptors using $LISTENFDS\n(see above).\n",
                        "long": "--inetd"
                    },
                    {
                        "name": "-E --setenv=",
                        "content": "Add this variable to the environment of the launched process. If VAR is followed by \"=\",\nassume that it is a variable–value pair. Otherwise, obtain the value from the environment\nof systemd-socket-activate itself.\n\n--fdname=NAME[:NAME...]\nSpecify names for the file descriptors passed. This is equivalent to setting\nFileDescriptorName= in socket unit files, and enables use of sdlistenfdswithnames(3).\nMultiple entries may be specifies using separate options or by separating names with\ncolons (\":\") in one option. In case more names are given than descriptors, superfluous\nones will be ignored. In case less names are given than descriptors, the remaining file\ndescriptors will be unnamed.\n",
                        "flag": "-E"
                    },
                    {
                        "name": "-h --help",
                        "content": "Print a short help text and exit.\n",
                        "flag": "-h",
                        "long": "--help"
                    },
                    {
                        "name": "--version",
                        "content": "Print a short version string and exit.\n",
                        "long": "--version"
                    }
                ]
            },
            "ENVIRONMENT VARIABLES": {
                "content": "$LISTENFDS, $LISTENPID, $LISTENFDNAMES\nSee sdlistenfds(3).\n\n$SYSTEMDLOGTARGET, $SYSTEMDLOGLEVEL, $SYSTEMDLOGTIME, $SYSTEMDLOGCOLOR,\n$SYSTEMDLOGLOCATION\nSame as in systemd(1).\n",
                "subsections": []
            },
            "EXAMPLES": {
                "content": "",
                "subsections": [
                    {
                        "name": "Example 1. Run an echo server on port 2000",
                        "content": "$ systemd-socket-activate -l 2000 --inetd -a cat\n"
                    },
                    {
                        "name": "Example 2. Run a socket-activated instance of systemd-journal-gatewayd(8)",
                        "content": "$ systemd-socket-activate -l 19531 /lib/systemd/systemd-journal-gatewayd\n"
                    }
                ]
            },
            "SEE ALSO": {
                "content": "systemd(1), systemd.socket(5), systemd.service(5), systemd-run(1), sdlistenfds(3),\nsdlistenfdswithnames(3), cat(1)\n\n\n\nsystemd 249                                                               SYSTEMD-SOCKET-ACTIVATE(1)",
                "subsections": []
            }
        }
    }
}