Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3768698
D3509.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D3509.diff
View Options
diff --git a/net-mgmt/phpfpm_exporter_lusitaniae/Makefile b/net-mgmt/phpfpm_exporter_lusitaniae/Makefile
--- a/net-mgmt/phpfpm_exporter_lusitaniae/Makefile
+++ b/net-mgmt/phpfpm_exporter_lusitaniae/Makefile
@@ -31,6 +31,8 @@
tomasen:fcgi_client:2bb3d819fd19:tomasen_fcgi_client/vendor/github.com/tomasen/fcgi_client
GO_TARGET= :phpfpm_exporter
+USE_RC_SUBR= phpfpm_exporter
+
CONFLICTS= phpfpm_exporter
PLIST_FILES= bin/phpfpm_exporter
diff --git a/net-mgmt/phpfpm_exporter_lusitaniae/files/phpfpm_exporter.in b/net-mgmt/phpfpm_exporter_lusitaniae/files/phpfpm_exporter.in
new file mode 100644
--- /dev/null
+++ b/net-mgmt/phpfpm_exporter_lusitaniae/files/phpfpm_exporter.in
@@ -0,0 +1,56 @@
+#!/bin/sh
+
+# PROVIDE: phpfpm_exporter
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# phpfpm_exporter_enable (bool): Set it to YES to enable phpfpm_exporter.
+# Default is "NO".
+# phpfpm_exporter_user (user): Set user to run phpfpm_exporter.
+# That user needs read access to php-fpm sockets.
+# Default is "nobody".
+# phpfpm_exporter_sockets_root (path): Set the root directory where to find php-fpm sockets.
+# Default is "/var/run".
+# phpfpm_exporter_sockets_pattern (path): Set the pattern to match php-fpm sockets paths.
+# Default is "php-fpm.sock".
+# phpfpm_exporter_status (string): Set to the php-fpm pm.status_path value.
+# Default is "/status".
+# phpfpm_exporter_address (string): Set the address listened by metrics exporter.
+# Default is "127.0.0.1:9253"
+
+. /etc/rc.subr
+
+name=phpfpm_exporter
+rcvar=phpfpm_exporter_enable
+
+load_rc_config $name
+
+: ${phpfpm_exporter_enable:="NO"}
+: ${phpfpm_exporter_user:="nobody"}
+: ${phpfpm_exporter_sockets_root:="/var/run"}
+: ${phpfpm_exporter_sockets_pattern:="php-fpm.sock"}
+: ${phpfpm_exporter_status:="/status"}
+: ${phpfpm_exporter_address:="127.0.0.1:9253"}
+
+sockets_found=$(find "${phpfpm_exporter_sockets_root}" -type s -name "${phpfpm_exporter_sockets_pattern}" -print0 | xargs -0 -n1 echo --phpfpm.socket-paths | paste -sd " " -)
+
+phpfpm_exporter_args="--web.listen-address=${phpfpm_exporter_address} --phpfpm.status-path=${phpfpm_exporter_status}"
+
+pidfile=/var/run/phpfpm_exporter.pid
+procname="phpfpm_exporter"
+command="/usr/sbin/daemon"
+command_args="-f -t ${name} -p ${pidfile} ${procname} ${phpfpm_exporter_args} ${sockets_found}"
+
+start_precmd=phpfpm_exporter_startprecmd
+required_files="$phpfpm_exporter_config"
+
+phpfpm_exporter_startprecmd()
+{
+ touch ${pidfile}
+ chown ${phpfpm_exporter_user} ${pidfile}
+}
+
+run_rc_command "$1"
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 09:50 (16 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2257228
Default Alt Text
D3509.diff (2 KB)
Attached To
Mode
D3509: [net-mgmt/phpfpm_exporter_lusitaniae] Add rc service
Attached
Detach File
Event Timeline
Log In to Comment