История изменений
Исправление
Odalist,
(текущая версия)
:
Нет там ничего про сокеты.
Тебе носом тыкнуть?
systemd has made a lot of fuss about socket activation, and how it’s the next best thing after sliced bread. I agree it’s a great idea, but the idea didn’t come from systemd, AFAIK it came from OSX. But, do we need systemd to get the same in Linux?
def start_with_socket(id, stream, cmd)
server = TCPServer.new(stream)
Thread.new do
loop do
socket = server.accept
system(*cmd, :in => socket, : out => socket)
end
end
end
start_with_socket('sshd', 22, %w[/usr/bin/sshd -i])
Believe it or not, this simple code achieves socket activation. We create a socket, and a new thread that waits for connections, if nobody connects, nothing happens, we have an idle thread, each time somebody connects, we launch ssh -i, which as far as I can tell is the same thing xinetd does, and systemd.
Исправление
Odalist,
:
Нет там ничего про сокеты.
Тебе носом тыкнуть?
systemd has made a lot of fuss about socket activation, and how it’s the next best thing after sliced bread. I agree it’s a great idea, but the idea didn’t come from systemd, AFAIK it came from OSX. But, do we need systemd to get the same in Linux?
def start_with_socket(id, stream, cmd)
server = TCPServer.new(stream)
Thread.new do
loop do
socket = server.accept
system(*cmd, :in => socket, : out => socket)
end
end
end
start_with_socket('sshd', 22, %w[/usr/bin/sshd -i])
Believe it or not, this simple code achieves socket activation. We create a socket, and a new thread that waits for connections, if nobody connects, nothing happens, we have an idle thread, each time somebody connects, we launch ssh -i, which as far as I can tell is the same thing xinetd does, and systemd.
Тут смысл, бро, в том, что как в systemd это реализовано.
Исходная версия
Odalist,
:
Нет там ничего про сокеты.
Тебе носом тыкнуть?
systemd has made a lot of fuss about socket activation, and how it’s the next best thing after sliced bread. I agree it’s a great idea, but the idea didn’t come from systemd, AFAIK it came from OSX. But, do we need systemd to get the same in Linux?
def start_with_socket(id, stream, cmd)
server = TCPServer.new(stream)
Thread.new do
loop do
socket = server.accept
system(*cmd, :in => socket, : out => socket)
end
end
end
start_with_socket('sshd', 22, %w[/usr/bin/sshd -i])
>Believe it or not, this simple code achieves socket activation. We create a socket, and a new thread that waits for connections, if nobody connects, nothing happens, we have an idle thread, each time somebody connects, we launch ssh -i, which as far as I can tell is the same thing xinetd does, and systemd.
Тут смысл, бро, в том, что как в systemd это реализовано.