File: fireflier-server.init

package info (click to toggle)
fireflier 1.1.6-3etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 3,348 kB
  • ctags: 1,167
  • sloc: sh: 9,023; cpp: 8,370; makefile: 437; ansic: 300
file content (67 lines) | stat: -rw-r--r-- 1,287 bytes parent folder | download
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
56
57
58
59
60
61
62
63
64
65
66
67
#! /bin/bash
# fireflier startup script
# (=modified version of debian apache startup script)

NAME=fireflier
PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/sbin
DAEMON=/usr/sbin/fireflierd
PIDFILE=/var/run/$NAME.pid
CONF=/etc/fireflier/fireflier.conf

trap "" 1
export LANG=C
export PATH

test -f $DAEMON || exit 0

if egrep -q -i "^[[:space:]]*start_server[[:space:]]*=[[:space:]]*no" $CONF
then
    echo "not starting fireflier server as requested in $CONF"
    exit 0
fi

# make sure we have a secure directory to make temporary files in.
function maketmpdir() {
  if [ ! -d /var/run/fireflier ]; then
        mkdir /var/run/fireflier
  fi
  chmod 0700 /var/run/fireflier
}


case "$1" in
  start)
    echo -n "Starting fireflier server: $NAME"
    maketmpdir
	modprobe ip_queue 2>/dev/null
    start-stop-daemon --start --background --make-pidfile --pidfile $PIDFILE --exec $DAEMON
    ;;

  stop)
    echo -n "Stopping fireflier server: $NAME"
    start-stop-daemon --stop --pidfile $PIDFILE --oknodo --exec $DAEMON
    ;;

  restart)
    $0 stop
    $0 start
    ;;

  force-reload)
    $0 stop
    $0 start
    ;;

  *)
    echo "Usage: /etc/init.d/$NAME {start|stop|restart|force-reload}"
    exit 1
    ;;
esac

if [ $? == 0 ]; then
	echo .
	exit 0
else
	echo failed
	exit 1
fi