From 724ef98c9bba0b4585a19f934feba253af5d5e8c Mon Sep 17 00:00:00 2001
From: Daniel Winzen <d@winzen4.de>
Date: Sat, 19 Oct 2019 20:45:59 +0200
Subject: [PATCH] prevent deleting sockets of other php instances

---
 etc/systemd/system/php7.2-fpm.service         | 1 -
 etc/systemd/system/php7.2-fpm@.service        | 1 +
 etc/systemd/system/php7.2-fpm@default.service | 1 +
 etc/systemd/system/php7.3-fpm.service         | 2 +-
 etc/systemd/system/php7.3-fpm@.service        | 1 +
 etc/systemd/system/php7.3-fpm@default.service | 1 +
 etc/systemd/system/php7.4-fpm.service         | 1 -
 etc/systemd/system/php7.4-fpm@.service        | 1 +
 etc/systemd/system/php7.4-fpm@default.service | 1 +
 9 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/etc/systemd/system/php7.2-fpm.service b/etc/systemd/system/php7.2-fpm.service
index b0d238c..c943af8 100644
--- a/etc/systemd/system/php7.2-fpm.service
+++ b/etc/systemd/system/php7.2-fpm.service
@@ -14,4 +14,3 @@ ExecReload=/bin/true
 
 [Install]
 WantedBy=multi-user.target
-
diff --git a/etc/systemd/system/php7.2-fpm@.service b/etc/systemd/system/php7.2-fpm@.service
index fc8b406..fd2245a 100644
--- a/etc/systemd/system/php7.2-fpm@.service
+++ b/etc/systemd/system/php7.2-fpm@.service
@@ -30,6 +30,7 @@ CPUQuota=100%
 MemoryHigh=25%
 MemoryMax=35%
 RuntimeDirectory=php
+RuntimeDirectoryPreserve=yes
 
 [Install]
 WantedBy=multi-user.target
diff --git a/etc/systemd/system/php7.2-fpm@default.service b/etc/systemd/system/php7.2-fpm@default.service
index e6947b8..93feefb 100644
--- a/etc/systemd/system/php7.2-fpm@default.service
+++ b/etc/systemd/system/php7.2-fpm@default.service
@@ -32,6 +32,7 @@ CPUQuota=100%
 MemoryHigh=25%
 MemoryMax=35%
 RuntimeDirectory=php
+RuntimeDirectoryPreserve=yes
 
 [Install]
 WantedBy=multi-user.target
diff --git a/etc/systemd/system/php7.3-fpm.service b/etc/systemd/system/php7.3-fpm.service
index e6cab3b..6923625 100644
--- a/etc/systemd/system/php7.3-fpm.service
+++ b/etc/systemd/system/php7.3-fpm.service
@@ -11,7 +11,7 @@ Type=oneshot
 RemainAfterExit=yes
 ExecStart=/bin/true
 ExecReload=/bin/true
+RuntimeDirectoryPreserve=yes
 
 [Install]
 WantedBy=multi-user.target
-
diff --git a/etc/systemd/system/php7.3-fpm@.service b/etc/systemd/system/php7.3-fpm@.service
index 647b652..7d1d91b 100644
--- a/etc/systemd/system/php7.3-fpm@.service
+++ b/etc/systemd/system/php7.3-fpm@.service
@@ -30,6 +30,7 @@ CPUQuota=100%
 MemoryHigh=25%
 MemoryMax=35%
 RuntimeDirectory=php
+RuntimeDirectoryPreserve=yes
 
 [Install]
 WantedBy=multi-user.target
diff --git a/etc/systemd/system/php7.3-fpm@default.service b/etc/systemd/system/php7.3-fpm@default.service
index 7b07eca..5d5c048 100644
--- a/etc/systemd/system/php7.3-fpm@default.service
+++ b/etc/systemd/system/php7.3-fpm@default.service
@@ -32,6 +32,7 @@ CPUQuota=100%
 MemoryHigh=25%
 MemoryMax=35%
 RuntimeDirectory=php
+RuntimeDirectoryPreserve=yes
 
 [Install]
 WantedBy=multi-user.target
diff --git a/etc/systemd/system/php7.4-fpm.service b/etc/systemd/system/php7.4-fpm.service
index e6cab3b..3a5f376 100644
--- a/etc/systemd/system/php7.4-fpm.service
+++ b/etc/systemd/system/php7.4-fpm.service
@@ -14,4 +14,3 @@ ExecReload=/bin/true
 
 [Install]
 WantedBy=multi-user.target
-
diff --git a/etc/systemd/system/php7.4-fpm@.service b/etc/systemd/system/php7.4-fpm@.service
index fde0114..3432a1a 100644
--- a/etc/systemd/system/php7.4-fpm@.service
+++ b/etc/systemd/system/php7.4-fpm@.service
@@ -30,6 +30,7 @@ CPUQuota=100%
 MemoryHigh=25%
 MemoryMax=35%
 RuntimeDirectory=php
+RuntimeDirectoryPreserve=yes
 
 [Install]
 WantedBy=multi-user.target
diff --git a/etc/systemd/system/php7.4-fpm@default.service b/etc/systemd/system/php7.4-fpm@default.service
index de7d1c0..1dd9cfe 100644
--- a/etc/systemd/system/php7.4-fpm@default.service
+++ b/etc/systemd/system/php7.4-fpm@default.service
@@ -32,6 +32,7 @@ CPUQuota=100%
 MemoryHigh=25%
 MemoryMax=35%
 RuntimeDirectory=php
+RuntimeDirectoryPreserve=yes
 
 [Install]
 WantedBy=multi-user.target