summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-cluster/gmqtt/files')
-rw-r--r--sys-cluster/gmqtt/files/confd1
-rw-r--r--sys-cluster/gmqtt/files/gmqttd.service14
-rw-r--r--sys-cluster/gmqtt/files/initd26
-rw-r--r--sys-cluster/gmqtt/files/logrotated3
4 files changed, 44 insertions, 0 deletions
diff --git a/sys-cluster/gmqtt/files/confd b/sys-cluster/gmqtt/files/confd
new file mode 100644
index 000000000000..5b25df933eed
--- /dev/null
+++ b/sys-cluster/gmqtt/files/confd
@@ -0,0 +1 @@
+GMQTTD_OPTS="-c /etc/gmqtt/gmqttd.yml start"
diff --git a/sys-cluster/gmqtt/files/gmqttd.service b/sys-cluster/gmqtt/files/gmqttd.service
new file mode 100644
index 000000000000..3c90faedba3c
--- /dev/null
+++ b/sys-cluster/gmqtt/files/gmqttd.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=Gmqtt Broker Service
+After=network.target
+
+[Service]
+Type=simple
+User=nobody
+Environment=GMQTTD_OPTS="-c /etc/gmqtt/gmqttd.yml start"
+Restart=on-failure
+RestartSec=5s
+ExecStart=/usr/bin/gmqttd $GMQTTD_OPTS
+
+[Install]
+WantedBy=multi-user.target
diff --git a/sys-cluster/gmqtt/files/initd b/sys-cluster/gmqtt/files/initd
new file mode 100644
index 000000000000..9285f0d59a81
--- /dev/null
+++ b/sys-cluster/gmqtt/files/initd
@@ -0,0 +1,26 @@
+#!/sbin/openrc-run
+
+description="Gmqtt Broker Service"
+pidfile=${pidfile:-"/run/${RC_SVCNAME}.pid"}
+command="/usr/bin/gmqttd"
+command_user="nobody:nobody"
+command_args="${GMQTTD_OPTS=:-"-c /etc/gmqtt/gmqttd.yml start"}"
+command_background="true"
+logfile=/var/log/gmqtt/${RC_SVCNAME}.log
+start_stop_daemon_args="--user ${command_user%:*} --group ${command_user#*:}
+ --stdout ${logfile} --stderr ${logfile}"
+
+: "${supervisor:=supervise-daemon}"
+: "${respawn_delay:=5}"
+: "${respawn_max:=10}"
+: "${respawn_period:=60}"
+
+depend() {
+ need net
+}
+
+start() {
+ checkpath --directory --mode 755 --owner root "${pidfile%/*}"
+ checkpath --directory --mode 755 --owner "${command_user}" "${logfile%/*}"
+ default_start
+}
diff --git a/sys-cluster/gmqtt/files/logrotated b/sys-cluster/gmqtt/files/logrotated
new file mode 100644
index 000000000000..4b84aa11f977
--- /dev/null
+++ b/sys-cluster/gmqtt/files/logrotated
@@ -0,0 +1,3 @@
+/var/log/gmqtt/*.log {
+ copytruncate
+}