summaryrefslogtreecommitdiff
blob: b745e11fd94a7d76421bbc2f1dbcd6e74a88afe2 (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
#!/sbin/openrc-run
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

PNAME=svxlink
NAME="SvxLink Server"
DAEMON=/usr/bin/$PNAME

POPTS="--daemon \
	${RUNASUSER:+--runasuser=$RUNASUSER} \
	${PIDFILE:+--pidfile=$PIDFILE} \
	${LOGFILE:+--logfile=$LOGFILE} \
	${CFGFILE:+--config=$CFGFILE}"

create_logfile()
{
  touch $LOGFILE
  if [ -n "$RUNASUSER" ]; then
    chown $RUNASUSER.$RUNASUSER $LOGFILE
  fi
}


depend() {
  need localmount
  use net
  after bootmisc
}

start() {
  ebegin "Starting $NAME"
  create_logfile
  export $ENV
  start-stop-daemon --start --pidfile $PIDFILE --exec $DAEMON -- $POPTS
  eend $?
}

stop() {
  ebegin "Stopping $NAME"
  start-stop-daemon --stop --pidfile $PIDFILE --exec $DAEMON
  eend $?
}