Automating startup of Darwin Streaming Server


Recently I have been using Darwin Streaming Media Server for some small movies. However, I quickly found out that when I rebooted the server Darwin does not automatically start up with it. It was necessary to start it manually each time the server was rebooted or started. Needless to day I find this very inconvenient. So I decided to write a startup script. It was really very easy, as you will see below.

I am using Fedora Core 4 and did a normal install of Darwin 5.5 from Apple.

Then I added the following script as the directory /etc/rc.d/init.d/darwinssd with darwinssd being the filename, not a directory.
You will need to be superuser in order to write to this directory.

#!/bin/bash
#
# created by Adam Culp of Unique Web Sites, Inc.
# at www.uniquewebsites.com
#
# darwinssd     Startup script for the Darwin Streaming Server
#
# chkconfig: 345 85 15
# description: Darwin Streaming Server startup/shutdown script
# processname: darwinssd
# pidfile: /var/run/darwinssd.pid

darwinssd=/usr/local/sbin/DarwinStreamingServer
RETVAL=0

# Source function library.
. /etc/rc.d/init.d/functions

case "$1" in
start)
echo -n "Starting Darwin Streaming Server[darwinssd]: "
daemon $darwinssd
RETVAL=$?
echo
touch /var/lock/subsys/darwinssd
;;
stop)
echo -n "Shutting down Darwin Streaming Server[darwinssd]: "
killproc $darwinssd
RETVAL=$?
echo
rm -f /var/lock/subsys/darwinssd
rm -f /var/run/darwinssd.pid
;;
status)
status $darwinssd
;;
restart)
$0 stop
$0 start
;;
reload)
echo -n "Reloading darwinssd: "
killproc $darwinssd -HUP
echo
;;
*)
echo "Usage: $0 {start|stop|restart|reload|status}"
exit 1

esac

exit 0

Of course you will also need to change the permissions on the file darwinssd to be -rwxr-xr-x (or 755).

At this point you can treat darwinssd as if it was any other daemon. You can add it to the starup with:(must be root user for this command)

chkconfig darwinssd on

As a superuser you would type it as:

/sbin/chkconfig darwinssd on

It also has other features such as start, stop, restart, and reload.
The same applies here for any of these commands:

service darwinssd restart

or as superuser

/sbin/service darwinssd restart
, ,

2 responses to “Automating startup of Darwin Streaming Server”

  1. I get this terminal response whenever I try to start, stop, restart, etc, using your script:
    “env: /etc/init.d/darwinssd: No such file or directory”

    Any ideas?

    I have full root and have tried both “service darwinssd restart” and “/sbin/service darwinssd restart”.

  2. Hi Adam,

    First off I want to thank you for instructions on automating the Darwin Streaming Server startup process. That was very helpful!

    Now I have another question for you. I have DSS installed, however, I need to install it on multiple servers and so I’m looking to automate the installation of the server. I’m able to download and install the server automatically, but the part that I can’t figure out is how to automate the web admin section. I was wondering if you could help me out in this area.

    Thanks!