summaryrefslogtreecommitdiffabout
path: root/debian/iii.init
blob: c60c25e19f4e0f3ce4f1bdfd5677c318cf209d64 (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
56
57
#!/bin/sh
### BEGIN INIT INFO
# Provides:          iii
# Required-Start:    $remote_fs $network
# Required-Stop:     $remote_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start iii eye-fi card manager daemon.
### END INIT INFO

set -e

PATH=/sbin:/bin:/usr/sbin:/usr/bin
NAME=iii
DAEMON=/usr/sbin/${NAME}d
DESC="Eye-Fi card manager daemon"
PIDFILE=/var/run/${NAME}d.pid
SCRIPTNAME=/etc/init.d/$NAME
USER=eyefi
SSD="/sbin/start-stop-daemon"

test -x $DAEMON || exit 0

if [ -f /etc/default/$NAME ] ; then
 . /etc/default/$NAME
 fi

test -z "$NO_IIID" || exit 0

. /lib/lsb/init-functions

case "$1" in
 start)
  log_daemon_msg "Starting $DESC" $NAME
  $SSD --start --pidfile $PIDFILE --chuid $USER --background --make-pidfile --exec $DAEMON -- $DAEMON_OPTS
  log_end_msg $?
  ;;
 stop)
  log_daemon_msg "Stopping $DESC" $NAME
  if $SSD --stop --oknodo --retry 30 --pidfile $PIDFILE --exec $DAEMON ; then
   rm -f $PIDFILE
   log_end_msg 0
  else
   log_end_msg 1
  fi
  ;;
 restart|force-reload)
  $SCRIPTNAME stop
  $SCRIPTNAME start
  ;;
 *)
  echo "Usage: $SCRIPTNAME {start|stop}" >&2
  exit 1
  ;;
esac

exit 0