in reply to Re: Systemd socket activated service in perl
in thread Systemd socket activated service in perl
And after some digging, here's a systemd version. It uses the very same server code in /home/rick/code/pm11157093.pl from this node's parent (change to your liking),
and is called pfs (for perl forking server).
Make file /etc/systemd/system/pfs.socket
# perl forking server https://perlmonks.org/?node_id=11157093 [Unit] Description=perl forking socket [Socket] ListenStream=1234 Accept=yes
and file /etc/systemd/system/pfs@.service
# perl forking server https://perlmonks.org/?node_id=11157093 [Unit] Description=perl forking server Requires=pfs.socket [Service] ExecStart=-/home/rick/code/pm11157093.pl StandardInput=socket
run systemctl start pfs.socket
and fire up a telnet to test it.
Some extra config lines may be required to start automatically at boot,
plus systemctl enable pfs.socket
Perhaps a systemd expert can fill in any holes I've missed.
UPDATE: the remote addr is in $ENV{REMOTE_ADDR} (see man systemd.socket)
|
|---|