-rwxr-xr-x | debian/iii.init | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/debian/iii.init b/debian/iii.init new file mode 100755 index 0000000..c60c25e --- a/dev/null +++ b/debian/iii.init | |||
@@ -0,0 +1,57 @@ | |||
1 | #!/bin/sh | ||
2 | ### BEGIN INIT INFO | ||
3 | # Provides: iii | ||
4 | # Required-Start: $remote_fs $network | ||
5 | # Required-Stop: $remote_fs $network | ||
6 | # Default-Start: 2 3 4 5 | ||
7 | # Default-Stop: 0 1 6 | ||
8 | # Short-Description: Start iii eye-fi card manager daemon. | ||
9 | ### END INIT INFO | ||
10 | |||
11 | set -e | ||
12 | |||
13 | PATH=/sbin:/bin:/usr/sbin:/usr/bin | ||
14 | NAME=iii | ||
15 | DAEMON=/usr/sbin/${NAME}d | ||
16 | DESC="Eye-Fi card manager daemon" | ||
17 | PIDFILE=/var/run/${NAME}d.pid | ||
18 | SCRIPTNAME=/etc/init.d/$NAME | ||
19 | USER=eyefi | ||
20 | SSD="/sbin/start-stop-daemon" | ||
21 | |||
22 | test -x $DAEMON || exit 0 | ||
23 | |||
24 | if [ -f /etc/default/$NAME ] ; then | ||
25 | . /etc/default/$NAME | ||
26 | fi | ||
27 | |||
28 | test -z "$NO_IIID" || exit 0 | ||
29 | |||
30 | . /lib/lsb/init-functions | ||
31 | |||
32 | case "$1" in | ||
33 | start) | ||
34 | log_daemon_msg "Starting $DESC" $NAME | ||
35 | $SSD --start --pidfile $PIDFILE --chuid $USER --background --make-pidfile --exec $DAEMON -- $DAEMON_OPTS | ||
36 | log_end_msg $? | ||
37 | ;; | ||
38 | stop) | ||
39 | log_daemon_msg "Stopping $DESC" $NAME | ||
40 | if $SSD --stop --oknodo --retry 30 --pidfile $PIDFILE --exec $DAEMON ; then | ||
41 | rm -f $PIDFILE | ||
42 | log_end_msg 0 | ||
43 | else | ||
44 | log_end_msg 1 | ||
45 | fi | ||
46 | ;; | ||
47 | restart|force-reload) | ||
48 | $SCRIPTNAME stop | ||
49 | $SCRIPTNAME start | ||
50 | ;; | ||
51 | *) | ||
52 | echo "Usage: $SCRIPTNAME {start|stop}" >&2 | ||
53 | exit 1 | ||
54 | ;; | ||
55 | esac | ||
56 | |||
57 | exit 0 | ||