#!/bin/sh
#
# description: chrome mem logger
#
# Get function from functions library
. /etc/init.d/functions
# Start the service chrome mem logger
start() {
        if [ -n "`/bin/pidof -xs /usr/bin/chrome_memlog`" ] ; then
          echo Already started
        else
          echo Starting
          /usr/bin/chrome_memlog &
          ### Create the lock file ###
          touch /var/lock/subsys/chrome_memlog
        fi
}
# Restart the service chrome mem logger
stop() {
        if [ -n "`/bin/pidof -xs /usr/bin/chrome_memlog`" ] ; then
          echo Stopping
          kill $(pidof -xs /usr/bin/chrome_memlog)
          ### Now, delete the lock file ###
          rm -f /var/lock/subsys/chrome_memlog
        else
          echo Already stopped
        fi
}
status() {
        if [ -n "`/bin/pidof -xs /usr/bin/chrome_memlog`" ] ; then
                echo chrome_memlog is running
        else
                echo chrome_memlog is stopped
        fi
}
### main logic ###
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        status chrome_memlog
        ;;
  restart|reload|condrestart)
        stop
        start
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart|reload|status}"
        exit 1
esac
exit 0
