aboutsummaryrefslogtreecommitdiff
path: root/gmid/files
diff options
context:
space:
mode:
Diffstat (limited to 'gmid/files')
-rw-r--r--gmid/files/gmid.conf.new24
-rw-r--r--gmid/files/rc.gmid.new56
2 files changed, 80 insertions, 0 deletions
diff --git a/gmid/files/gmid.conf.new b/gmid/files/gmid.conf.new
new file mode 100644
index 0000000..3b725ad
--- /dev/null
+++ b/gmid/files/gmid.conf.new
@@ -0,0 +1,24 @@
+log {
+ access /var/log/gmid/gmid.log
+}
+
+# An example of a server block:
+server "localhost" {
+ listen on * port 1965
+
+ # set the directory to serve
+ root "localhost"
+
+ # Set self-signed TLS cert and key. It's better to keep
+ # the keys outside the chroot.
+ #
+ # sudo -u gmid -- \
+ # openssl req -x509 \
+ # -newkey rsa:4096 \
+ # -nodes \
+ # -out /etc/gmid/certs/localhost.crt \
+ # -keyout /etc/gmid/certs/localhost.key \
+ # -subj "/CN=localhost"
+ cert "/etc/gmid/certs/localhost.crt"
+ key "/etc/gmid/certs/localhost.key"
+}
diff --git a/gmid/files/rc.gmid.new b/gmid/files/rc.gmid.new
new file mode 100644
index 0000000..33044b7
--- /dev/null
+++ b/gmid/files/rc.gmid.new
@@ -0,0 +1,56 @@
+#!/bin/sh
+#
+# Startup/shutdown script for the gmid gemini service.
+#
+
+create_run_dir() {
+ if [ ! -d /run/gmid/ ]; then
+ mkdir -p /run/gmid
+ chown :gmid /run/gmid
+ chmod g+wX /run/gmid
+ fi
+}
+
+start() {
+ echo "Starting gmid gemini service"
+ create_run_dir
+
+ sudo -u gmid -- gmid \
+ -c /etc/gmid/gmid.conf \
+ -P /run/gmid/gmid.pid
+}
+
+status() {
+ create_run_dir
+
+ if [ -f /run/gmid/gmid.pid ] && [ kill -0 "$(cat /run/gmid/gmid.pid)" >/dev/null ]; then
+ echo "gmid is running"
+ else
+ echo "gmid is not running"
+ fi
+}
+
+stop() {
+ echo "Stopping gmid gemini service"
+ create_run_dir
+
+ if [ -f /run/gmid/gmid.pid ]; then
+ sudo -u gmid -- kill -SIGINT "$(cat /run/gmid/gmid.pid)"
+ fi
+}
+
+case "$1" in
+start)
+ start
+ ;;
+status)
+ status
+ ;;
+stop)
+ stop
+ ;;
+*)
+ echo "Usage: $0 {start|stop|status}"
+ exit 1
+esac
+