]>
Commit | Line | Data |
---|---|---|
1417f1b2 | 1 | #!/bin/sh |
0cea9a65 | 2 | # |
43c771f2 ER |
3 | # flixengine |
4 | # | |
5 | # chkconfig: 345 12 88 | |
6 | # | |
7 | # description: On2 Technologies Flix Engine init script | |
8 | # processname: flixd | |
110d4697 | 9 | |
0cea9a65 ER |
10 | # Source function library |
11 | . /etc/rc.d/init.d/functions | |
12 | ||
1417f1b2 ER |
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. | |
977f216d | 18 | export FLIXD_MENCODER=/usr/bin/mencoder-flixengine |
110d4697 | 19 | |
f2d0d47f | 20 | AUTHDIR=/etc/on2 |
ac12ede0 ER |
21 | PORT=2372 |
22 | USERID=flixd | |
38598339 | 23 | INTERFACE=lo |
110d4697 | 24 | |
1417f1b2 ER |
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 | |
110d4697 | 30 | fi |
1417f1b2 | 31 | # test for running portmapper |
110d4697 ER |
32 | } |
33 | ||
1417f1b2 ER |
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" | |
ac12ede0 | 39 | daemon --user $USERID /usr/sbin/flixd --authdir=$AUTHDIR \ |
cc478664 | 40 | --interface=$INTERFACE --port=$PORT --reuseaddr \ |
ac12ede0 | 41 | --pidfile /var/run/flixd/flixd.pid --logfile=/var/log/flixd.log |
1417f1b2 | 42 | RETVAL=$? |
ac12ede0 | 43 | [ $RETVAL = 0 ] && touch /var/lock/subsys/flixd |
110d4697 | 44 | else |
1417f1b2 ER |
45 | msg_already_running "Flix Engine" |
46 | fi | |
47 | } | |
48 | ||
49 | stop() { | |
50 | # Stop daemons. | |
51 | if [ -f /var/lock/subsys/flixd ]; then | |
7a3dcd1d | 52 | msg_stopping "Flix Engine" |
ac12ede0 | 53 | killproc --pidfile flixd/flixd.pid flixd |
7a3dcd1d | 54 | rm -f /var/lock/subsys/flixd |
1417f1b2 ER |
55 | else |
56 | msg_not_running "Flix Engine" | |
110d4697 ER |
57 | fi |
58 | } | |
0cea9a65 ER |
59 | |
60 | RETVAL=0 | |
61 | # See how we were called. | |
62 | case "$1" in | |
63 | start) | |
1417f1b2 | 64 | start |
0cea9a65 ER |
65 | ;; |
66 | stop) | |
1417f1b2 | 67 | stop |
0cea9a65 ER |
68 | ;; |
69 | restart) | |
1417f1b2 | 70 | stop |
0cea9a65 | 71 | sleep 1 |
1417f1b2 | 72 | start |
0cea9a65 | 73 | ;; |
182c2008 ER |
74 | status) |
75 | status flixd | |
76 | RETVAL=$? | |
77 | ;; | |
0cea9a65 | 78 | *) |
182c2008 | 79 | msg_usage "$0 {start|stop|restart|status}" |
0cea9a65 ER |
80 | exit 3 |
81 | ;; | |
110d4697 | 82 | esac |
0cea9a65 ER |
83 | |
84 | exit $RETVAL |