From b106c013037fe95e890f9bb64d4107f9e47f0fc4 Mon Sep 17 00:00:00 2001 From: Georg Date: Mon, 22 Nov 2021 17:11:41 +0100 Subject: [PATCH] Solaris SMF Service Signed-off-by: Georg --- distrib/SMF/README | 26 ++++++++++++++++++++++++ distrib/SMF/ergo | 26 ++++++++++++++++++++++++ distrib/SMF/ergo.xml | 48 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 100 insertions(+) create mode 100644 distrib/SMF/README create mode 100755 distrib/SMF/ergo create mode 100644 distrib/SMF/ergo.xml diff --git a/distrib/SMF/README b/distrib/SMF/README new file mode 100644 index 00000000..2e408459 --- /dev/null +++ b/distrib/SMF/README @@ -0,0 +1,26 @@ +Created 22/11/2021 by georg@lysergic.dev. + +This directory contains Service Management Facility service files for ergo. +These files should be compatible with current OpenSolaris / Illumos based operating systems. Tested on OpenIndiana. + +Prerequesites: + - ergo binary located at /opt/ergo/ergo + - ergo configuration located at /opt/ergo/ircd.yaml (hardcoded) + - ergo languages located at /opt/ergo/languages (to be compatible with default.yaml - you may adjust this path or disable languages in your custom ircd.yaml) + - ergo certificate and key located at /opt/ergo/fullchain.pem /opt/ergo/privkey.pem (to be compatible with default.yaml - you may adjust these paths in your custom ircd.yaml) + - `ergo` role user and `ergo` role group owning all of the above + +Installation: + - cp ergo.xml /lib/svc/manifest/network/ + - cp ergo /lib/svc/method/ + - svcadm restart manifest-import + +Usage: + - svcadm enable ergo (Start) + - tail /var/svc/log/network-ergo:default.log (Check ergo log and SMF output) + - svcs ergo (Check status) + - svcadm refresh ergo (Reload manifest and ergo configuration) + - svcadm disable ergo (Stop) + +Notes: + - Does not support multiple instances - spawns instance :default diff --git a/distrib/SMF/ergo b/distrib/SMF/ergo new file mode 100755 index 00000000..dae6bcfd --- /dev/null +++ b/distrib/SMF/ergo @@ -0,0 +1,26 @@ +#!/sbin/sh +# +# SMF method script for ergo - used by manifest file ergo.xml +# Created 22/11/2021 by georg@lysergic.dev + +. /lib/svc/share/smf_include.sh + +case $1 in +'start') + exec /opt/ergo/ergo run --conf /opt/ergo/ircd.yaml + ;; + +'refresh' ) + exec pkill -1 -U ergo -x ergo + ;; +'stop' ) + exec pkill -U ergo -x ergo + ;; + +*) + echo "Usage: $0 { start | refresh | stop }" + exit 1 + ;; +esac + +exit $? diff --git a/distrib/SMF/ergo.xml b/distrib/SMF/ergo.xml new file mode 100644 index 00000000..345d51e9 --- /dev/null +++ b/distrib/SMF/ergo.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +