# Wowza Media Server on FreeBSD

**URL:** <https://community.wowza.com/t/wowza-media-server-on-freebsd/35029>\
**Category:** Wowza Streaming Engine\
**Created:** [July 2, 2010, 10:41am UTC](https://community.wowza.com/t/wowza-media-server-on-freebsd/35029 "2010-07-02T10:41:26Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aleksej\_Kuzmin](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@Aleksej\_Kuzmin](https://community.wowza.com/u/Aleksej_Kuzmin)\
**Post date:** [July 2, 2010, 10:41am UTC](https://community.wowza.com/t/wowza-media-server-on-freebsd/35029/1 "2010-07-02T10:41:26Z")

</div>

Hello, Tell me, please, how to run the Wowza Media Server as daemon on FreeBSD 8? There are was no problems with the installation, using startup.sh it run normally, but “/path/to/WowzaMediaServer/bin/WowzaMediaServer start” does not work. How I can run it at startup and daemon mode?

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [July 2, 2010, 12:03pm UTC](https://community.wowza.com/t/wowza-media-server-on-freebsd/35029/2 "2010-07-02T12:03:20Z")

</div>

It’s in the User Manual, I think it is:

```auto
/etc/init.d/WowzaMediaServer start

```

or

```auto
/sbin/service WowzaMediaServer start

```

Richard

---

<div class="post-metadata">

**Author:** ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)\
**Post date:** [February 16, 2011, 4:12am UTC](https://community.wowza.com/t/wowza-media-server-on-freebsd/35029/3 "2011-02-16T04:12:20Z")

</div>

Here is the script:

```auto
#!/bin/bash
#
# Startup script for Wowza Media Server
#
# chkconfig: - 80 20
# description: Wowza Media Server is a media server
#
#### BEGIN INIT INFO
# Provides: WowzaMediaServer
# Required-Start: $syslog $time $local_fs $remote_fs
# Required-Stop: $syslog $time $local_fs $remote_fs
# Default-Start: 3 4 5
# Default-Stop: S 0 1 2 6
# Short-Description: Wowza Media Server 2 Init Script
# Description: Wowza Media Server 2 Init Script
### END INIT INFO
WMCOMMAND=${1}
FUNCTIONS_EXIST=false
if [-f /etc/rc.d/init.d/functions] ; then
     . /etc/rc.d/init.d/functions
     FUNCTIONS_EXIST=true
fi
if [-f /etc/init.d/functions] ; then
     . /etc/init.d/functions
     FUNCTIONS_EXIST=true
fi
if ! $FUNCTIONS_EXIST ; then
failure() {
  return 0
}
success() {
  return 0
}
fi
# define vars
RETVAL=0
WMSBASE_NAME=WowzaMediaServer
#WMSCONFIG_SCRIPT="/etc/WowzaMediaServer/$WMSBASE_NAME.conf"
WMSCONFIG_SCRIPT="/usr/local/WowzaMediaServer/bin/setenv.sh"
WMSLICENSE_FILE="/usr/local/WowzaMediaServer/conf/Server.license"
AMAZONEC2_INSTALL_SCRIPT="/usr/local/WowzaMediaServer/bin/AmazonEC2Install.sh"
WMSDAEMON_CMD=/usr/bin/WowzaMediaServerd
WMSPID_FILE="/var/run/$WMSBASE_NAME.pid"
WMSLOCK_FILE="/var/run/$WMSBASE_NAME"
SHUTDOWN_WAIT=20
[-r "$WMSCONFIG_SCRIPT"] && . "$WMSCONFIG_SCRIPT"
if ! test -f "${WMSLICENSE_FILE}" ; then
        echo ""
        echo "ERROR: Missing license file: (${WMSLICENSE_FILE})"
        echo "You must first run Wowza Media Server 2 in "
        echo "standalone mode to enter serial number. Execute the "
        echo "following commands to run in standalone mode:"
        echo ""
        echo "cd /usr/local/WowzaMediaServer"
        echo "./startup.sh"
        echo ""
        exit 0
fi
testjava=`which ${_EXECJAVA} 2>/dev/null`
if ! test -f "$testjava" ; then
	echo ""
	echo "ERROR: The Java command (${_EXECJAVA}) could not be found."
	echo "Search path: $PATH"
	echo "In most cases this problem can be fixed by adding a symbolic "
	echo "link to the Java command in the /usr/bin directory. "
	echo "To do this first execute the command \"which java\" to identify "
	echo "the full path to the Java executable. Next, create a symbolic "
	echo "link to this file with the command"
	echo "\"ln -sf [path-to-java] /usr/bin/java\" where [path-to-java] is "
	echo "the path returned by the \"which\" command."
	echo ""
	exit 0
fi
#
start() {
if [-f $WMSPID_FILE]; then
	read kpid < $WMSPID_FILE
	kill -9 $kpid
	echo $"$WMSBASE_NAME is already running ($kpid): stopping"
	rm -f $WMSPID_FILE
fi
echo -n $"$WMSBASE_NAME: starting"
#$AMAZONEC2_INSTALL_SCRIPT
$WMSDAEMON_CMD $WMSCONFIG_SCRIPT $WMSPID_FILE start >/dev/null 2>&1 &
success "$WMSBASE_NAME startup"
echo
touch $WMSLOCK_FILE
return 0
}
stop() {
if [-f $WMSPID_FILE]; then
	echo -n $"$WMSBASE_NAME: stopping"
	read kpid < $WMSPID_FILE
	$WMSDAEMON_CMD $WMSCONFIG_SCRIPT $WMSPID_FILE stop >/dev/null 2>&1 &
	let kwait=$SHUTDOWN_WAIT
	count=0;
	until [`ps -p $kpid | grep -c $kpid` = '0'] || [$count -gt $kwait]
	do
		echo -n -e "\nwaiting for processes to exit";
		sleep 1
		let count=$count+1;
	done
	if [$count -gt $kwait]; then
		echo -n -e "\nkilling processes which didn't stop after $SHUTDOWN_WAIT seconds"
		kill -9 $kpid
	fi
	rm -f $WMSPID_FILE
	success "$WMSBASE_NAME shutdown"
else
	echo -n $"$WMSBASE_NAME: not running"
fi
echo
rm -f $WMSLOCK_FILE
return 0
}
localstatus() {
if [-f $WMSLOCK_FILE]; then
	echo "$WMSBASE_NAME started"
else
	echo "$WMSBASE_NAME stopped"
fi
RETVAL=0
}
# See how we were called.
case "$WMCOMMAND" in
start)
start
;;
stop)
stop
;;
status)
localstatus
;;
restart)
stop
start
;;
*)
echo $"Usage: $WMSBASE_NAME {start|stop|restart|status}"
exit 1
esac
exit $RETVAL

```

Charlie

---

<div class="post-metadata">

**Author:** ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)\
**Post date:** [February 16, 2011, 4:27pm UTC](https://community.wowza.com/t/wowza-media-server-on-freebsd/35029/4 "2011-02-16T16:27:32Z")

</div>

We have a few customers on FreeBSD but not a lot. One of our largest customers is on FreeBSD but they did their own customization. We have had folks report that Java is not always super stable on FreeBSD. So I guess the answer is that for some it works for some it does not. Linux, Solaris, Unix all work great!

Charlie

---

<div class="post-metadata">

**Author:** ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)\
**Post date:** [June 30, 2011, 7:35am UTC](https://community.wowza.com/t/wowza-media-server-on-freebsd/35029/5 "2011-06-30T07:35:02Z")

</div>

We have serveral customers running the latest, latest Java VM (I think it is a build in the udpate 20 range) without any issues. Be sure you get the latest, latest version.

Charlie

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [July 2, 2010, 2:54pm UTC](https://community.wowza.com/t/wowza-media-server-on-freebsd/35029/6 "2010-07-02T14:54:06Z")

</div>

I search around and [found this](http://www.cyberciti.biz/tips/bsd-start-services.html) Try:

```auto
/etc/rc.d/WowzaMediaServer start

```

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [July 11, 2010, 3:01pm UTC](https://community.wowza.com/t/wowza-media-server-on-freebsd/35029/7 "2010-07-11T15:01:18Z")

</div>

This error means Wowza is already running, or another service using port 1935 is running – Maybe FMIS or red5.

Richard

---

<div class="post-metadata">

**Author:** ![Richard\_Lanham](https://avatars.discourse-cdn.com/v4/letter/r/c68b51/32.png) [@Richard\_Lanham](https://community.wowza.com/u/Richard_Lanham)\
**Post date:** [February 16, 2011, 1:53am UTC](https://community.wowza.com/t/wowza-media-server-on-freebsd/35029/8 "2011-02-16T01:53:05Z")

</div>

Should be able to use one of these:

```auto
/sbin/service WowzaMediaServer start
/etc/init.d/WowzaMediaServer start

```

Richard

---

<div class="post-metadata">

**Author:** ![Aleksej\_Kuzmin](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@Aleksej\_Kuzmin](https://community.wowza.com/u/Aleksej_Kuzmin)\
**Post date:** [July 2, 2010, 4:45pm UTC](https://community.wowza.com/t/wowza-media-server-on-freebsd/35029/9 "2010-07-02T16:45:50Z")

</div>

This is true for Linux, not for FreeBSD. There are no such paths.

---

<div class="post-metadata">

**Author:** ![Aleksej\_Kuzmin](https://avatars.discourse-cdn.com/v4/letter/a/3ec8ea/32.png) [@Aleksej\_Kuzmin](https://community.wowza.com/u/Aleksej_Kuzmin)\
**Post date:** [July 3, 2010, 7:10pm UTC](https://community.wowza.com/t/wowza-media-server-on-freebsd/35029/10 "2010-07-03T19:10:39Z")

</div>

Yes, that’s right, thanks, I know it. The fact that rc script was not created during installation, I wrote it myself. Thank you for your answers, topic can be closed.

---

<div class="post-metadata">

**Author:** ![Demian\_Konovalov](https://avatars.discourse-cdn.com/v4/letter/d/f17d59/32.png) [@Demian\_Konovalov](https://community.wowza.com/u/Demian_Konovalov)\
**Post date:** [July 11, 2010, 7:14am UTC](https://community.wowza.com/t/wowza-media-server-on-freebsd/35029/11 "2010-07-11T07:14:37Z")

</div>

Hello, i try install in FreeBSD and have a problem

/usr/local/WowzaMediaServer/bin/\>./start.sh

stop install

WARN vhost comment _defaultVHost_ Bind failed, try again ([any]:1935): java.net.BindException: Address already in use

😕

---

<div class="post-metadata">

**Author:** ![web\_master](https://avatars.discourse-cdn.com/v4/letter/w/4bbf92/32.png) [@web\_master](https://community.wowza.com/u/web_master)\
**Post date:** [February 15, 2011, 5:37pm UTC](https://community.wowza.com/t/wowza-media-server-on-freebsd/35029/12 "2011-02-15T17:37:38Z")

</div>

Hi Guys

I am having the same problem, I have just installed WowzaMediaServer on a FreeBSD 8.1 server and confirmed it works with standalone mode.

But I need the rc script to start it as a demon at boot. Does anyone have a copy of this?

Also, in the mean time, is there a way to keep Wowza running in standalone mode without having to have an open command line session? ‘Screen’ does not work ☹

Thanks 🙂

---

<div class="post-metadata">

**Author:** ![web\_master](https://avatars.discourse-cdn.com/v4/letter/w/4bbf92/32.png) [@web\_master](https://community.wowza.com/u/web_master)\
**Post date:** [February 16, 2011, 2:46am UTC](https://community.wowza.com/t/wowza-media-server-on-freebsd/35029/13 "2011-02-16T02:46:07Z")

</div>

Thanks for the reply.

But these paths do not exist in FreeBSD and there is no ‘WowzaMediaServer’ rc script anywhere else after the install.

---

<div class="post-metadata">

**Author:** ![web\_master](https://avatars.discourse-cdn.com/v4/letter/w/4bbf92/32.png) [@web\_master](https://community.wowza.com/u/web_master)\
**Post date:** [February 16, 2011, 6:12am UTC](https://community.wowza.com/t/wowza-media-server-on-freebsd/35029/14 "2011-02-16T06:12:47Z")

</div>

Thanks 🙂

I am modifying it now, but as this is my first real exposure to an rc script, I am having some trouble: at the moment I need to find the FreeBSD equivalent of ‘/etc/rc.d/init.d/functions’ or ‘/etc/init.d/functions’. I assumed it would be ‘/etc/rc.d’ but that was a no go ☹ I have also tries /etc/rc.subr, I added ‘WowzaMediaServer\_enable=“YES”’ to the /etc/rc.conf but t still fails to start at boot.

I can see there was a binary in the FreeBSD ports directory for Version 1.7.9, and I can only assume that it was ported properly and contains the correct files and paths. Unfortunately, it is no longer available so I can not steal the ported scripts from there. I don’t suppose your devs would have these laying around?

Perhaps I am a bit frustrated at this point, but why is it that the installation guide only takes the Unix install upto running in standalone mode? Is it officially unsupported in Unix/FreeBSD or is there a chance this will be fixed? At this point I seem to be developing the FreeBSD script for you… and I am no developer in any stretch of the imagination lol

---

<div class="post-metadata">

**Author:** ![web\_master](https://avatars.discourse-cdn.com/v4/letter/w/4bbf92/32.png) [@web\_master](https://community.wowza.com/u/web_master)\
**Post date:** [February 16, 2011, 5:50pm UTC](https://community.wowza.com/t/wowza-media-server-on-freebsd/35029/15 "2011-02-16T17:50:09Z")

</div>

That’s just it though, aside from the rc script everything else works great. From what I can tell, it is only a matter of a few paths, I just don’t get why there isn’t a script provided.

At least I get to learn stuff 🙂

Edit: Unfortunately, I have been unable to do this and the support team have decided that they are not interested in supporting a potential customer, losing a grand for what should be a simple task. Any other users hoping to use FreeBSD with Wowza should know that they will get no assistance, I can only expect this extends to other platforms. I have since found that there are other free options that come with proper support.

---

<div class="post-metadata">

**Author:** ![Enrico\_Kern](https://avatars.discourse-cdn.com/v4/letter/e/858c86/32.png) [@Enrico\_Kern](https://community.wowza.com/u/Enrico_Kern)\
**Post date:** [June 30, 2011, 1:02pm UTC](https://community.wowza.com/t/wowza-media-server-on-freebsd/35029/16 "2011-06-30T13:02:32Z")

</div>

is wowza 2 now “stable” on freeBSD? i would love to install freebsd to all of my like 20 servers or so but ive read in the forum that java seems to be unstable ? Does it work with the diablo jdk? Anyone got it in production on freebsd and can tell me some numbers?

---

<div class="post-metadata">

**Author:** ![Enrico\_Kern](https://avatars.discourse-cdn.com/v4/letter/e/858c86/32.png) [@Enrico\_Kern](https://community.wowza.com/u/Enrico_Kern)\
**Post date:** [June 30, 2011, 8:42pm UTC](https://community.wowza.com/t/wowza-media-server-on-freebsd/35029/17 "2011-06-30T20:42:58Z")

</div>

nice, thanks charlie.

then let the reinstalls begin! 😉

---

<div class="post-metadata">

**Author:** ![Frank\_Razenberg](https://avatars.discourse-cdn.com/v4/letter/f/0ea827/32.png) [@Frank\_Razenberg](https://community.wowza.com/u/Frank_Razenberg)\
**Post date:** [November 2, 2011, 12:44am UTC](https://community.wowza.com/t/wowza-media-server-on-freebsd/35029/18 "2011-11-02T00:44:17Z")

</div>

I attached what I came up with. Works for me on 8.2 and 9.0-RC1.

```auto
#!/bin/sh
# PROVIDE: wowza
# REQUIRE: NETWORKING SERVERS
# BEFORE: DAEMON
# KEYWORD: shutdown
wowza_enable="${wowza_enable:-"NO"}"
wowza_flags="${wowza_flags:-""}"
wowza_home="${wowza_home:-"/usr/local/WowzaMediaServer"}"
wowza_user="${wowza_user:-"www"}"
wowza_stop_timeout="${wowza_stop_timeout:-"5"}"
wowza_config_home="${wowza_config_home:-"/usr/local/WowzaMediaServer"}"
wowza_config_url="${wowza_config_url:-""}"
wowza_java_opts="${wowza_java_opts:-"-Xmx1200M -server -Djava.net.preferIPv4Stack=true"}"
wowza_stdout_log="${wowza_stdout_log:-"/var/log/wowza.log"}"
wowza_stderr_log="${wowza_stderr_log:-"/var/log/wowza.err"}"
. /etc/rc.subr
name="wowza"
rcvar=`set_rcvar`
pidfile="/var/run/${name}.pid"
procname="/usr/local/diablo-jre1.6.0/bin/java"
required_files="${wowza_home}/conf/Server.license"
load_rc_config "${name}"
if [-n "${wowza_java_home}"] ; then
	export JAVA_HOME="${wowza_java_home}"
fi
if [-n "${wowza_java_version}"] ; then
	export JAVA_VERSION="${wowza_java_version}"
fi
if [-n "${wowza_java_vendor}"] ; then
	export JAVA_VENDOR="${wowza_java_vendor}"
fi
if [-n "${wowza_java_os}"] ; then
	export JAVA_OS="${wowza_java_os}"
fi
case ${wowza_jmxconsole_enable} in
	[Yy][Ee][Ss])
		wowza_java_opts="${wowza_java_opts} -Dcom.sun.management.jmxremote=true "
		;;
	*)
		;;
esac
start_precmd=touch_logs
touch_logs () {
	touch $wowza_stdout_log && chown $wowza_user $wowza_stdout_log
	touch $wowza_stderr_log && chown $wowza_user $wowza_stderr_log
}
java_command="/usr/local/bin/java ${wowza_java_opts} \
	-Dcom.wowza.wms.AppHome=${wowza_home} \
	-Dcom.wowza.wms.ConfigURL=${wowza_config_url} \
	-Dcom.wowza.wms.ConfigHome=${wowza_config_home} \
	-cp ${wowza_home}/bin/wms-bootstrap.jar com.wowza.wms.bootstrap.Bootstrap"
log_args=">> ${wowza_stdout_log} 2>> ${wowza_stderr_log} "
command="/usr/sbin/daemon"
command_args="-p ${pidfile} ${java_command} ${wowza_flags} $1 ${log_args}"
run_rc_command "$1"

```
