#!/bin/bash

# Acer ASM43 init file for snmpd
#
# chkconfig: - 50 50
# description: Acer ASM43 SNMP Daemon
#
# processname: snmpd
# config: /usr/local/share/snmp/snmpd.conf
#         /etc/snmp/snmpd.conf
#         /usr/share/snmp/snmpd.conf
# Last Update: -lky, 89/6/19-
#

# source function library
. /etc/rc.d/init.d/functions

case "$1" in
  start)
	echo -n "Installing Acer ASM43 drivers: "
	cd /usr/local/share/asm
	./asm_load
	#./smb_load
	./ipm_load
	echo -n "Starting Acer ASM43 snmpd: "
        /usr/local/share/asm/snmpd&
	echo -n "Starting Acer ASM43 asmftu: "
	/usr/local/share/asm/asmftu&
	#echo -n "Starting Acer ASM43 bpbagent: "
	#/usr/local/share/asm/bpbagent&
	echo
	;;
  stop)
	#echo -n "Shutting down Acer ASM43 bpbagent: "
	#killproc bpbagent
	echo -n "Shutting down Acer ASM43 asmftu: "
	killproc asmftu
	echo -n "Shutting down Acer ASM43 snmpd: "
	killproc snmpd
	# don't use killproc, cause system hang, I don't know why -lky, 89/6/22-
	#kill -9 `ps -ef | grep -i snmpd | grep -v grep | cut -d " " -f 6`
	#kill -9 `ps -ef | grep -i snmpd | grep -v grep | cut -d " " -f 7`
	#kill -9 `ps -ef | grep -i snmpd | grep -v grep | cut -d " " -f 8`
	echo -n "Uninstalling Acer ASM43 drivers: "
	cd /usr/local/share/asm
	#./smb_unload
	./asm_unload
	./ipm_unload
	echo
	;;
  restart)
        $0 stop
        $0 start
        ;;
  status)
        status snmpd
        status asmftu
        ;;
  *)
	echo "Usage: asm-snmpd {start|stop|restart|status}"
	exit 1
esac

exit 0
