summaryrefslogtreecommitdiff
path: root/audio/SlimServer/rc.slimserver
blob: 9148e2a47fad9c6d5ff695a330816d314bfb0cb0 (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
#!/bin/sh
#
# /etc/rc.d/rc.slimserver
#

# Edit this to suit your setup
SLIMSERVER_USER="slimserver"
SLIMSERVER_HOME="/opt/slimserver"
SLIMSERVER_CFG="/etc/slimserver.conf"
SLIMSERVER_LOG="/var/log/slimserver.log"
SLIMSERVER_CACHE="/var/cache/slimserver"
SLIMSERVER_PLAYLISTS="/opt/slimserver/playlists"
SLIMSERVER_ARGS="--daemon --cachedir=$SLIMSERVER_CACHE \
                 --playlistdir=$SLIMSERVER_PLAYLISTS \
                 --prefsfile=$SLIMSERVER_CFG \
                 --logfile=$SLIMSERVER_LOG"
SLIMSERVER_BIN="$SLIMSERVER_HOME/slimserver.pl"


slimserver_start() {
  if [ -x $SLIMSERVER_BIN -a -r $SLIMSERVER_CFG ]; then
    echo "Starting Slimserver..."
    $SLIMSERVER_BIN --user $SLIMSERVER_USER $SLIMSERVER_ARGS
  fi
}

slimserver_stop() {
  echo "Stopping Slimserver..."
  killall slimserver.pl
}

slimserver_restart() {
  slimserver_stop
  sleep 2
  slimserver_start
}


case "$1" in
'start')
  slimserver_start
  ;;
'stop')
  slimserver_stop
  ;;
'restart')
  slimserver_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac