#! /bin/sh
#
# Dragan Marinkovic (dmarinkovi@sierrawireless.com)
# Copyright (c) 2014 Sierra Wireless
#
# Derived from Qualcomm Technologies qmuxd startup script. This will
# be removed once we have integrity monitor.

# qmuxd - init.d script to start QMI's qmuxd daemon

set -e

case "$1" in
  start)
        echo -n "Starting qmuxd: "
        /etc/init.d/start_qmuxd &
        echo "done"
        ;;
  stop)
        echo -n "Stopping qmuxd: "
        pid=$( ps -ef | grep start_qmuxd | grep -v grep | awk '{print $2}' )
        if [ "x${pid}" != "x" ] ; then
            kill -9 ${pid} >/dev/null 2>&1
        fi
        killall -9 qmuxd >/dev/null 2>&1
        echo "done"
        ;;
  restart)
        $0 stop
        $0 start
        ;;
  *)
        echo "Usage qmuxd { start | stop | restart}" >&2
        exit 1
        ;;
esac


exit 0
