]>
Commit | Line | Data |
---|---|---|
110d4697 | 1 | #!/bin/bash |
0cea9a65 | 2 | # |
110d4697 ER |
3 | # On2 Technologies Flix Engine init script |
4 | # Website: www.on2.com | |
5 | # Support: flixsupport@on2.com | |
6 | ||
0cea9a65 ER |
7 | # Source function library |
8 | . /etc/rc.d/init.d/functions | |
9 | ||
10 | # set some variables | |
11 | export PATH=/usr/sbin:/usr/libexec/on2/flixengine:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH | |
12 | export LD_LIBRARY_PATH=/usr/lib:/usr/lib:/lib:/usr/lib:/usr/local/lib:$LIBRARY_PATH | |
13 | export C_INCLUDE_PATH=/usr/include:/usr/include:/usr/local/include:$C_INCLUDE_PATH | |
110d4697 ER |
14 | ##Specify the mencoder binary for flixd to use when decoding source files. |
15 | ##If running flixd from the command line or using su within this script to run | |
16 | ##it as another user ensure that this environment variable is set. The default | |
17 | ##install path for mencoder will not be in PATH so without this variable set | |
18 | ##flixd will be unable to decode source files. | |
0cea9a65 | 19 | export FLIXD_MENCODER=/usr/libexec/on2/flixengine/mencoder |
110d4697 ER |
20 | |
21 | # test for running portmapper | |
22 | if ! rpcinfo -p 1>/dev/null 2>&1; then | |
23 | echo "WARNING: portmap does not appear to be running." | |
24 | echo "Flix Engine requires the portmap service to run." | |
25 | if [ -e /etc/rc.d/rc.portmap ];then | |
26 | if [ ! -x /etc/rc.d/rc.portmap ]; then | |
27 | echo "/etc/rc.d/rc.portmap not executable. Try chmod 755 /etc/rc.d/rc.portmap" | |
28 | echo "and then run /etc/rc.d/rc.portmap" | |
29 | exit | |
30 | fi | |
31 | fi | |
32 | sysvstart=`ls /etc/rc3.d/*portmap 2>/dev/null` | |
33 | if [ "$sysvstart" != "" ]; then | |
34 | echo "Found $sysvstart." | |
35 | echo "This needs to be setup to execute on startup." | |
36 | exit | |
37 | fi | |
38 | ||
39 | echo "If portmap is not installed you must install it first. See your distro documentation." | |
40 | exit | |
41 | fi | |
42 | ||
43 | fstart(){ | |
0cea9a65 | 44 | /usr/sbin/flixd --authdir=/home/glen/.on2 --pidfile /usr/var/run/flixd.pid |
110d4697 ER |
45 | if [ "$?" = "0" ]; then |
46 | echo "Started Flix Engine." | |
47 | return 0 | |
48 | else | |
49 | echo "Problem starting Flix Engine." | |
50 | return 1 | |
51 | fi | |
52 | } | |
53 | ||
54 | fstop(){ | |
0cea9a65 ER |
55 | if [ ! -e /usr/var/run/flixd.pid ]; then |
56 | echo "PID file /usr/var/run/flixd.pid not found." | |
110d4697 ER |
57 | if [ "$1" = "restart" ]; then |
58 | echo "Still attempting to restart service." | |
59 | else | |
60 | exit | |
61 | fi | |
62 | else | |
0cea9a65 ER |
63 | kill `cat /usr/var/run/flixd.pid` |
64 | if [ "$?" = "0" ]; the | |
110d4697 ER |
65 | echo "Stopped Flix Engine" |
66 | fi | |
67 | fi | |
68 | } | |
0cea9a65 ER |
69 | |
70 | RETVAL=0 | |
71 | # See how we were called. | |
72 | case "$1" in | |
73 | start) | |
74 | fstart | |
75 | ;; | |
76 | stop) | |
77 | fstop | |
78 | ;; | |
79 | restart) | |
80 | fstop | |
81 | sleep 1 | |
82 | fstart | |
83 | ;; | |
84 | *) | |
85 | msg_usage "$0 {start|stop|restart}" | |
86 | exit 3 | |
87 | ;; | |
110d4697 | 88 | esac |
0cea9a65 ER |
89 | |
90 | exit $RETVAL |