aboutsummaryrefslogtreecommitdiffsponsor
path: root/contrib/slackbuild/rc.mirror
blob: 28a1d2f93bdec81ec972aae75a8b55070ccbb2f4 (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
49
50
51
52
53
54
55
#!/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
}

mirror_start() {
  echo "Starting Mirror service"
  create_run_dir

  daemon \
    --name=mirror \
    --user=mirror \
    --pidfiles=/run/mirror \
    --output=/var/log/mirror/mirror.log \
    -- mirror
}

mirror_stop() {
  echo "Stopping Mirror service"
  /usr/bin/daemon --name=mirror --pidfiles=/run/mirror --stop
}

mirror_reload() {
  /usr/bin/daemon --name=mirror --pidfiles=/run/mirror --signal=hup
}

mirror_status() {
  /usr/bin/daemon --name=mirror --pidfiles=/run/mirror --running --verbose
}

case "$1" in
start)
  mirror_start
  ;;
stop)
  mirror_stop
  ;;
reload)
  mirror_reload
  ;;
status)
  mirror_status
  ;;
*)
  echo "Usage: $0 {start|stop|reload|status}"
  exit 1
esac