Page MenuHomeDevCentral

No OneTemporary

diff --git a/roles/webserver-alkane/php/files/restart-php-fpm.sh b/roles/webserver-alkane/php/files/restart-php-fpm.sh
new file mode 100755
index 0000000..c121cbe
--- /dev/null
+++ b/roles/webserver-alkane/php/files/restart-php-fpm.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+# -------------------------------------------------------------
+# Restart php-fpm
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# License: Trivial work, not eligible to copyright
+# Source file: roles/webserver-alkane/php/files/restart-php-fpm.sh
+# Description: Deploy and restart php-fpm service
+# -------------------------------------------------------------
+
+set -e
+
+# -------------------------------------------------------------
+# Ensure user is root
+#
+# Note: POSIX shells don't always define $UID or $EUID.
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+if [ "${EUID:-$(id -u)}" -ne 0 ]; then
+ echo "This command must be run as root." >&2
+ exit 1
+fi
+
+
+# -------------------------------------------------------------
+# Update through Salt the service if needed & restart php-fpm
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+grep -q auto-generated /usr/local/etc/rc.d/php-fpm || salt-call state.apply roles/webserver-alkane/php/service
+/usr/local/etc/rc.d/php-fpm restart
diff --git a/roles/webserver-alkane/php/service.sls b/roles/webserver-alkane/php/service.sls
index 5e130e1..dd87f51 100644
--- a/roles/webserver-alkane/php/service.sls
+++ b/roles/webserver-alkane/php/service.sls
@@ -1,41 +1,46 @@
# -------------------------------------------------------------
# Salt — Provision PHP websites — php-fpm service
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
# -------------------------------------------------------------
# Service
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{% if grains['os'] == 'FreeBSD' %}
{% set instances = " ".join(pillar['php_fpm_instances'].keys()) %}
/usr/local/etc/rc.d/php-fpm:
file.managed:
- source: salt://roles/webserver-alkane/php/files/rc/php-fpm
- mode: 755
+/usr/local/bin/restart-php-fpm:
+ file.managed:
+ - source: salt://roles/webserver-alkane/php/files/restart-php-fpm.sh
+ - mode: 755
+
/etc/rc.conf.d/php_fpm:
file.directory
/etc/rc.conf.d/php_fpm/instances:
file.managed:
- source: salt://roles/webserver-alkane/php/files/rc/instances
- template: jinja
- context:
instances: {{ instances }}
{% for instance, config in pillar['php_fpm_instances'].items() %}
/etc/rc.conf.d/php_fpm/{{ instance }}:
file.managed:
- source: salt://roles/webserver-alkane/php/files/rc/per_instance
- template: jinja
- context:
instance: {{ instance }}
command: {{ config['command'] | default('') }}
{% endfor %}
{% endif %}

File Metadata

Mime Type
text/x-diff
Expires
Sun, Nov 24, 19:42 (3 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2258815
Default Alt Text
(3 KB)

Event Timeline