With wowza, sometimes java gets stuck and you can even run service WowzaMediaServer stop and start after it remain stuck until you properly kill java ( as you might know wowza it is running under java).
This being said here we go ( tested on 2 ubuntu 12.04 environment with both wowza 3.6 and 4.0.3 versions)
# touch restart.sh <-- create the restart script # chmod 755 <-- make it writable # nano restart.sh < write commands to run it it
This is based on java we would like to kill java and not Wowza.
Wowza 2.2 up to 3.6.X version 1
# nano restart.sh # kill -9 $(pidof java) # sleep 5 # service WowzaMediaServer start
Press control + X and Y and enter to save the file. If you are using Wowza 4.X or higher you should run this.
Wowza 4.X and higher version 2
# kill -9 $(pidof java) # sleep 5 # service WowzaStreamingEngine start # sleep 5 # service WowzaStreamingEngineManager start
Press control + X and Y and enter to save the file.
From wowza 4.0 you know they also have the browser interface which is based also on java so that’s why you need to start both EngineManager and Engine.
Now each time when you want to restart wowza you can use the script like this :
Make a restart every night at 00:00 automatically ( i would do this to reset the garbage collector of java and free memory usage).
Assuming you have the script in root create here we go.
# crontab -e ( this will open crontab in your favorite editor)
If you never use crontab this will let you chose your editor.
If you before used an editor and now you want to change it you should type this for example for nano in ssh.
# export EDITOR=nano
Now you should type this on cron:
# 00 00 * * * /root/restart.sh
Save it and restart your cron service.
# service crond restart
Now you should be good about wowza restart.