aboutsummaryrefslogtreecommitdiff
path: root/contrib/slackbuild/rc.mirror
diff options
context:
space:
mode:
authorSlack Coder <slackcoder@server.ky>2024-04-08 15:29:11 -0500
committerSlack Coder <slackcoder@server.ky>2024-07-18 11:47:49 -0500
commitae748859be8d6d3ed3c0929770f0c287ab6d6460 (patch)
tree284d3bf3d7fa496a9d334391eac996affc5a01b9 /contrib/slackbuild/rc.mirror
parentc2267767ca8ed06018d26a45b483c44b7c4234cf (diff)
downloadmirror-0.0.1-dev.tar.xz (sig)
Port to Golangv0.0.1-dev
Diffstat (limited to 'contrib/slackbuild/rc.mirror')
-rw-r--r--contrib/slackbuild/rc.mirror48
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