aboutsummaryrefslogtreecommitdiff
path: root/zot/rc.zot
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2026-11-12 23:42:26 +0100
committerEugen Wissner <belka@caraus.de>2026-11-12 23:42:26 +0100
commit068c2bc175861d8d35194e6f5b224b183a1fbc55 (patch)
tree9d097e56770b67956ebe55c517be64e55d53a0e8 /zot/rc.zot
parent2e0a185719106d3fdee3eebb72ea5264b28403a2 (diff)
downloadslackbuilds-068c2bc175861d8d35194e6f5b224b183a1fbc55.tar.gz
zot: Added rc file
Diffstat (limited to 'zot/rc.zot')
-rw-r--r--zot/rc.zot56
1 files changed, 56 insertions, 0 deletions
diff --git a/zot/rc.zot b/zot/rc.zot
new file mode 100644
index 0000000..ec63fa8
--- /dev/null
+++ b/zot/rc.zot
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+PIDFILE=/var/run/zot.pid
+LOGFILE=/var/log/zot.log
+CONFIG_FILE=/etc/zot/config.yaml
+
+zot_start() {
+ if [ -s $PIDFILE ]; then
+ echo "zot is already running: $(cat $PIDFILE)."
+ exit 1
+ fi
+
+ /usr/bin/zot serve $CONFIG_FILE >> $LOGFILE 2>&1 &
+ pidof /usr/bin/zot > $PIDFILE
+}
+
+zot_stop() {
+ if [ -s $PIDFILE ]; then
+ kill $(cat $PIDFILE)
+ rm -f $PIDFILE
+ else
+ echo "zot is not running."
+ fi
+}
+
+zot_restart() {
+ zot_stop
+ sleep 1
+ zot_start
+}
+
+zot_status() {
+ if [ -s $PIDFILE ]; then
+ echo "zot is running: $(cat $PIDFILE)."
+ else
+ echo "zot is not running."
+ fi
+}
+
+case "$1" in
+ 'start')
+ zot_start
+ ;;
+ 'stop')
+ zot_stop
+ ;;
+ 'restart')
+ zot_restart
+ ;;
+ 'status')
+ zot_status
+ ;;
+ *)
+ echo "usage: $0 start|stop|restart|status"
+ ;;
+esac