]>
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 | |
5a4c0c22 ER |
20 | ## Avoid potential seg fault due to unchecked allocations within libogg. |
21 | ## This will force a read error should any encode instance's ogg demuxer | |
22 | ## use more than 70% of available physical memory | |
23 | ## See flixd(8) for further details. | |
24 | export FLIX_OGG_PHYMEM_PCTMAX=70 | |
25 | ||
f2d0d47f | 26 | AUTHDIR=/etc/on2 |
ac12ede0 ER |
27 | PORT=2372 |
28 | USERID=flixd | |
38598339 | 29 | INTERFACE=lo |
110d4697 | 30 | |
73b04271 JR |
31 | if [ "$1" != "stop" ]; then |
32 | check_portmapper || { nls "Error: portmap isn't running" && exit 0; } | |
33 | fi | |
110d4697 | 34 | |
19b221d4 | 35 | # Get service config - may override defaults |
bbeddf23 | 36 | [ -f /etc/sysconfig/flixd ] && . /etc/sysconfig/flixd |
19b221d4 ER |
37 | |
38 | start() { | |
1417f1b2 ER |
39 | # Check if the service is already running? |
40 | if [ ! -f /var/lock/subsys/flixd ]; then | |
1417f1b2 | 41 | msg_starting "Flix Engine" |
e5799ffb | 42 | export LD_LIBRARY_PATH=/usr/lib/flixd |
ac12ede0 | 43 | daemon --user $USERID /usr/sbin/flixd --authdir=$AUTHDIR \ |
cc478664 | 44 | --interface=$INTERFACE --port=$PORT --reuseaddr \ |
ac12ede0 | 45 | --pidfile /var/run/flixd/flixd.pid --logfile=/var/log/flixd.log |
1417f1b2 | 46 | RETVAL=$? |
ac12ede0 | 47 | [ $RETVAL = 0 ] && touch /var/lock/subsys/flixd |
110d4697 | 48 | else |
1417f1b2 ER |
49 | msg_already_running "Flix Engine" |
50 | fi | |
51 | } | |
52 | ||
53 | stop() { | |
54 | # Stop daemons. | |
55 | if [ -f /var/lock/subsys/flixd ]; then | |
7a3dcd1d | 56 | msg_stopping "Flix Engine" |
ac12ede0 | 57 | killproc --pidfile flixd/flixd.pid flixd |
7a3dcd1d | 58 | rm -f /var/lock/subsys/flixd |
1417f1b2 ER |
59 | else |
60 | msg_not_running "Flix Engine" | |
110d4697 ER |
61 | fi |
62 | } | |
0cea9a65 ER |
63 | |
64 | RETVAL=0 | |
65 | # See how we were called. | |
66 | case "$1" in | |
67 | start) | |
1417f1b2 | 68 | start |
0cea9a65 ER |
69 | ;; |
70 | stop) | |
1417f1b2 | 71 | stop |
0cea9a65 ER |
72 | ;; |
73 | restart) | |
1417f1b2 | 74 | stop |
0cea9a65 | 75 | sleep 1 |
1417f1b2 | 76 | start |
0cea9a65 | 77 | ;; |
182c2008 ER |
78 | status) |
79 | status flixd | |
80 | RETVAL=$? | |
81 | ;; | |
0cea9a65 | 82 | *) |
182c2008 | 83 | msg_usage "$0 {start|stop|restart|status}" |
0cea9a65 ER |
84 | exit 3 |
85 | ;; | |
110d4697 | 86 | esac |
0cea9a65 ER |
87 | |
88 | exit $RETVAL |