diff options
Diffstat (limited to 'zot/rc.zot')
| -rw-r--r-- | zot/rc.zot | 56 |
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 |
