]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | # | |
3 | # flixengine | |
4 | # | |
5 | # chkconfig: 345 12 88 | |
6 | # | |
7 | # description: On2 Technologies Flix Engine init script | |
8 | # processname: flixd | |
9 | ||
10 | # Source function library | |
11 | . /etc/rc.d/init.d/functions | |
12 | ||
13 | ## Specify the mencoder binary for flixd to use when decoding source files. | |
14 | ## If running flixd from the command line or using su within this script to run | |
15 | ## it as another user ensure that this environment variable is set. The default | |
16 | ## install path for mencoder will not be in PATH so without this variable set | |
17 | ## flixd will be unable to decode source files. | |
18 | export FLIXD_MENCODER=/usr/bin/mencoder-flixengine | |
19 | ||
20 | AUTHDIR=/etc/on2 | |
21 | PORT=2372 | |
22 | USERID=flixd | |
23 | INTERFACE=lo | |
24 | ||
25 | check_portmap() { | |
26 | if [ ! -f /var/lock/subsys/portmap ]; then | |
27 | echo >&2 "ERROR: portmap does not appear to be running." | |
28 | echo >&2 "Flix Engine requires the portmap service to run." | |
29 | exit 1 | |
30 | fi | |
31 | # test for running portmapper | |
32 | } | |
33 | ||
34 | start(){ | |
35 | # Check if the service is already running? | |
36 | if [ ! -f /var/lock/subsys/flixd ]; then | |
37 | check_portmap | |
38 | msg_starting "Flix Engine" | |
39 | daemon --user $USERID /usr/sbin/flixd --authdir=$AUTHDIR \ | |
40 | --interface=$INTERFACE --port=$PORT --reuseaddr \ | |
41 | --pidfile /var/run/flixd/flixd.pid --logfile=/var/log/flixd.log | |
42 | RETVAL=$? | |
43 | [ $RETVAL = 0 ] && touch /var/lock/subsys/flixd | |
44 | else | |
45 | msg_already_running "Flix Engine" | |
46 | fi | |
47 | } | |
48 | ||
49 | stop() { | |
50 | # Stop daemons. | |
51 | if [ -f /var/lock/subsys/flixd ]; then | |
52 | msg_stopping "Flix Engine" | |
53 | killproc --pidfile flixd/flixd.pid flixd | |
54 | rm -f /var/lock/subsys/flixd | |
55 | else | |
56 | msg_not_running "Flix Engine" | |
57 | fi | |
58 | } | |
59 | ||
60 | RETVAL=0 | |
61 | # See how we were called. | |
62 | case "$1" in | |
63 | start) | |
64 | start | |
65 | ;; | |
66 | stop) | |
67 | stop | |
68 | ;; | |
69 | restart) | |
70 | stop | |
71 | sleep 1 | |
72 | start | |
73 | ;; | |
74 | status) | |
75 | status flixd | |
76 | RETVAL=$? | |
77 | ;; | |
78 | *) | |
79 | msg_usage "$0 {start|stop|restart|status}" | |
80 | exit 3 | |
81 | ;; | |
82 | esac | |
83 | ||
84 | exit $RETVAL |