| 1 | #!/bin/sh |
|---|
| 2 | # Darwin Streaming Media Server |
|---|
| 3 | |
|---|
| 4 | # chkconfig: 35 50 50 |
|---|
| 5 | # description: Darwin Streaming Media Server |
|---|
| 6 | # |
|---|
| 7 | ### BEGIN INIT INFO |
|---|
| 8 | # Provides: darwin-streaming-server |
|---|
| 9 | # Required-Start: $local_fs $remote_fs $network $syslog |
|---|
| 10 | # Required-Stop: |
|---|
| 11 | # Default-Start: 2 3 4 5 |
|---|
| 12 | # Default-Stop: 0 1 6 |
|---|
| 13 | # Description: Darwin Streaming Media Server |
|---|
| 14 | ### END INIT INFO |
|---|
| 15 | |
|---|
| 16 | # What is this? |
|---|
| 17 | DESC="Darwin Streaming Media Server" |
|---|
| 18 | D0="streaming server" |
|---|
| 19 | D1="DSS administration console" |
|---|
| 20 | PREFIX=/usr/local |
|---|
| 21 | |
|---|
| 22 | # Exit if required binaries are missing. |
|---|
| 23 | [ -x $PREFIX/sbin/DarwinStreamingServer ] || exit 0 |
|---|
| 24 | [ -x $PREFIX/sbin/streamingadminserver.pl ] || exit 0 |
|---|
| 25 | |
|---|
| 26 | . /lib/lsb/init-functions |
|---|
| 27 | |
|---|
| 28 | # See how we were called. |
|---|
| 29 | case "$1" in |
|---|
| 30 | start) |
|---|
| 31 | log_daemon_msg "Starting $DESC" |
|---|
| 32 | log_progress_msg "$D0" |
|---|
| 33 | start-stop-daemon --start --oknodo --quiet \ |
|---|
| 34 | --exec $PREFIX/sbin/DarwinStreamingServer |
|---|
| 35 | if [ $? != 0 ]; then |
|---|
| 36 | log_end_msg $? |
|---|
| 37 | exit $? |
|---|
| 38 | fi |
|---|
| 39 | |
|---|
| 40 | log_progress_msg "$D1" |
|---|
| 41 | start-stop-daemon --start --oknodo --quiet \ |
|---|
| 42 | --exec $PREFIX/sbin/streamingadminserver.pl |
|---|
| 43 | if [ $? != 0 ]; then |
|---|
| 44 | log_end_msg $? |
|---|
| 45 | exit $? |
|---|
| 46 | fi |
|---|
| 47 | |
|---|
| 48 | log_end_msg 0 |
|---|
| 49 | ;; |
|---|
| 50 | |
|---|
| 51 | stop) |
|---|
| 52 | log_daemon_msg "Stopping $DESC" |
|---|
| 53 | |
|---|
| 54 | log_progress_msg "$D0" |
|---|
| 55 | start-stop-daemon --stop --oknodo --quiet --name DarwinStreaming --retry 3 |
|---|
| 56 | if [ $? != 0 ]; then |
|---|
| 57 | log_end_msg $? |
|---|
| 58 | exit $? |
|---|
| 59 | fi |
|---|
| 60 | |
|---|
| 61 | start-stop-daemon --stop --oknodo --quiet --name streamingadmins |
|---|
| 62 | if [ $? != 0 ]; then |
|---|
| 63 | log_end_msg $? |
|---|
| 64 | exit $? |
|---|
| 65 | fi |
|---|
| 66 | |
|---|
| 67 | log_end_msg 0 |
|---|
| 68 | ;; |
|---|
| 69 | |
|---|
| 70 | status) |
|---|
| 71 | if pidof DarwinStreamingServer >/dev/null |
|---|
| 72 | then |
|---|
| 73 | echo "$D0 running" |
|---|
| 74 | else |
|---|
| 75 | echo "$D0 not running" |
|---|
| 76 | exit 3 |
|---|
| 77 | fi |
|---|
| 78 | if pidof streamingadminserver.pl >/dev/null |
|---|
| 79 | then |
|---|
| 80 | echo "$D1 running" |
|---|
| 81 | else |
|---|
| 82 | echo "$D1 not running" |
|---|
| 83 | exit 3 |
|---|
| 84 | fi |
|---|
| 85 | exit 0 |
|---|
| 86 | ;; |
|---|
| 87 | |
|---|
| 88 | restart) |
|---|
| 89 | $0 stop |
|---|
| 90 | sleep 1 |
|---|
| 91 | $0 start |
|---|
| 92 | ;; |
|---|
| 93 | |
|---|
| 94 | *) |
|---|
| 95 | log_success_msg "Usage: darwin-streaming-server {start|stop|status|restart}" |
|---|
| 96 | exit 1 |
|---|
| 97 | ;; |
|---|
| 98 | esac |
|---|
| 99 | |
|---|
| 100 | exit 0 |
|---|