#!/bin/bash
omgstopall
omgstartilid

OS=$(if [ -e /etc/redhat-release ]; then cat /etc/redhat-release | head -n 1 | cut -d " " -f 1 ; else if [ -r /etc/issue ] ; then cat /etc/issue | head -n 1 | cut -d " " -f 1 ; else echo unknown ; fi; fi)
if [ "${OS}" = "Ubuntu" ]; then
    /usr/bin/switchsyslog
    which /etc/init.d/avahi-daemon 2>&1 && /etc/init.d/avahi-daemon restart
    /etc/init.d/omg.start
elif [ "${OS}" = "Debian" ]; then
    /usr/bin/switchsyslog
    which /etc/init.d/avahi-daemon 2>&1 && systemctl restart avahi-daemon
    systemctl restart omg
else
    /usr/bin/switchsyslog
    service omg start
    service omgproducermanager start
    service omgwebui start
fi
