From 068c2bc175861d8d35194e6f5b224b183a1fbc55 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Thu, 12 Nov 2026 23:42:26 +0100 Subject: zot: Added rc file --- zot/rc.zot | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 zot/rc.zot (limited to 'zot/rc.zot') 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 -- cgit v1.2.3