]>
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 | ||
13 | # set some variables | |
1417f1b2 ER |
14 | export PATH=$PATH:/usr/libexec/on2/flixengine |
15 | ## Specify the mencoder binary for flixd to use when decoding source files. | |
16 | ## If running flixd from the command line or using su within this script to run | |
17 | ## it as another user ensure that this environment variable is set. The default | |
18 | ## install path for mencoder will not be in PATH so without this variable set | |
19 | ## flixd will be unable to decode source files. | |
0cea9a65 | 20 | export FLIXD_MENCODER=/usr/libexec/on2/flixengine/mencoder |
110d4697 | 21 | |
1417f1b2 | 22 | AUTHDIR=/var/lib/on2 |
110d4697 | 23 | |
1417f1b2 ER |
24 | check_portmap() { |
25 | if [ ! -f /var/lock/subsys/portmap ]; then | |
26 | echo >&2 "ERROR: portmap does not appear to be running." | |
27 | echo >&2 "Flix Engine requires the portmap service to run." | |
28 | exit 1 | |
110d4697 | 29 | fi |
1417f1b2 | 30 | # test for running portmapper |
110d4697 ER |
31 | } |
32 | ||
1417f1b2 ER |
33 | start(){ |
34 | # Check if the service is already running? | |
35 | if [ ! -f /var/lock/subsys/flixd ]; then | |
36 | check_portmap | |
37 | msg_starting "Flix Engine" | |
38 | /usr/sbin/flixd --authdir=$AUTHDIR --pidfile /var/run/flixd.pid | |
39 | RETVAL=$? | |
40 | if [ $RETVAL = 0 ]; then | |
7a3dcd1d | 41 | touch /var/lock/subsys/flixd |
1417f1b2 | 42 | ok |
110d4697 | 43 | else |
1417f1b2 | 44 | fail |
110d4697 ER |
45 | fi |
46 | else | |
1417f1b2 ER |
47 | msg_already_running "Flix Engine" |
48 | fi | |
49 | } | |
50 | ||
51 | stop() { | |
52 | # Stop daemons. | |
53 | if [ -f /var/lock/subsys/flixd ]; then | |
7a3dcd1d | 54 | msg_stopping "Flix Engine" |
1417f1b2 | 55 | killproc --pidfile flixd.pid flixd |
7a3dcd1d | 56 | rm -f /var/lock/subsys/flixd |
1417f1b2 ER |
57 | else |
58 | msg_not_running "Flix Engine" | |
110d4697 ER |
59 | fi |
60 | } | |
0cea9a65 ER |
61 | |
62 | RETVAL=0 | |
63 | # See how we were called. | |
64 | case "$1" in | |
65 | start) | |
1417f1b2 | 66 | start |
0cea9a65 ER |
67 | ;; |
68 | stop) | |
1417f1b2 | 69 | stop |
0cea9a65 ER |
70 | ;; |
71 | restart) | |
1417f1b2 | 72 | stop |
0cea9a65 | 73 | sleep 1 |
1417f1b2 | 74 | start |
0cea9a65 | 75 | ;; |
182c2008 ER |
76 | status) |
77 | status flixd | |
78 | RETVAL=$? | |
79 | ;; | |
0cea9a65 | 80 | *) |
182c2008 | 81 | msg_usage "$0 {start|stop|restart|status}" |
0cea9a65 ER |
82 | exit 3 |
83 | ;; | |
110d4697 | 84 | esac |
0cea9a65 ER |
85 | |
86 | exit $RETVAL |