Add systemd unit files for malpd and support systemd socket activation
This commit is contained in:
parent
c717b5d589
commit
1180849b44
@ -62,12 +62,16 @@ if Process.uid != 0
|
|||||||
exit(1)
|
exit(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if ENV["LISTEN_FDS"]
|
||||||
|
server = UNIXServer.for_fd(3)
|
||||||
|
else
|
||||||
FileUtils.mkdir_p(File.dirname(SOCKET_PATH))
|
FileUtils.mkdir_p(File.dirname(SOCKET_PATH))
|
||||||
FileUtils.rm_f(SOCKET_PATH)
|
FileUtils.rm_f(SOCKET_PATH)
|
||||||
|
|
||||||
server = UNIXServer.new(SOCKET_PATH)
|
server = UNIXServer.new(SOCKET_PATH)
|
||||||
File.chmod(0660, SOCKET_PATH)
|
File.chmod(0660, SOCKET_PATH)
|
||||||
FileUtils.chown(nil, "apache", SOCKET_PATH)
|
FileUtils.chown(nil, "apache", SOCKET_PATH)
|
||||||
|
end
|
||||||
|
|
||||||
Signal.trap("TERM") { server.close }
|
Signal.trap("TERM") { server.close }
|
||||||
Signal.trap("INT") { server.close }
|
Signal.trap("INT") { server.close }
|
||||||
|
|||||||
10
systemd/malpd.service
Normal file
10
systemd/malpd.service
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=MALP monitoring daemon
|
||||||
|
Requires=malpd.socket
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=/var/www/malp/bin/malpd
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
10
systemd/malpd.socket
Normal file
10
systemd/malpd.socket
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=malpd Unix socket
|
||||||
|
|
||||||
|
[Socket]
|
||||||
|
ListenStream=/run/malpd/malpd.sock
|
||||||
|
SocketGroup=apache
|
||||||
|
SocketMode=0660
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=sockets.target
|
||||||
Loading…
x
Reference in New Issue
Block a user