Closed hannesm closed 2 years ago
Hmm, but on Linux systems there's no /usr/libexec -- so what is the way to go on Linux for installing daemons and avoiding them to be accidentally started multiple times?
One way would be to look whether the socket exists, and if yes, whether there's something listening upon connect.
Any ideas /cc @reynir
On Linux the systemd scripts use systemd socket activation -- A separate albatross_console.socket systemd file exists that creates the socket and on connection starts up albatross-console --systemd-socket-activation
(via albatross_console.service) and passes the socket as a file descriptor. If used this way then creating the socket is handled by systemd and I think it should avoid recreating/claiming existing sockets. But this of course does not prevent a user from manually running albatross-console
.
I would be in favor of moving the daemon binaries to /usr/libexec/ as that would make it less likely a user would run the binary directly.
To avoid accidental executions of albatross_console etc. (which will create and claim the socket). Eventually these programs should as well not start up if the socket is already there and opened (but that may lead to rather intricate semantics).