aboutsummaryrefslogtreecommitdiffsponsor
path: root/contrib/slackbuild/rc.mirror
blob: 81acb9bd74ab979c33fd4200085845faa888bb2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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