diff options
Diffstat (limited to 'contrib/slackbuild/rc.mirror')
-rw-r--r-- | contrib/slackbuild/rc.mirror | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/contrib/slackbuild/rc.mirror b/contrib/slackbuild/rc.mirror new file mode 100644 index 0000000..81acb9b --- /dev/null +++ b/contrib/slackbuild/rc.mirror @@ -0,0 +1,48 @@ +#!/bin/sh +# +# Startup/shutdown script for the mirror service. +# + +create_run_dir() { + if [ ! -d /run/mirror/ ]; then + mkdir -p /run/mirror + chown :mirror /run/mirror + chmod g+wX /run/mirror + fi +} + +start() { + echo "Starting Mirror service" + create_run_dir + + daemon \ + --name=mirror \ + --user=mirror \ + --pidfiles=/run/mirror \ + --output=/var/log/mirror/mirror.log \ + -- mirror -config /etc/mirror/config.json +} + +stop() { + echo "Stopping Mirror service" + /usr/bin/daemon --name=mirror --pidfiles=/run/mirror --stop +} + +status() { + /usr/bin/daemon --name=mirror --pidfiles=/run/mirror --running --verbose +} + +case "$1" in +start) + start + ;; +stop) + stop + ;; +status) + status + ;; +*) + echo "Usage: $0 {start|stop|status}" + exit 1 +esac |