HEX
Server: Apache/2
System: Linux jingle.dotvndns.vn 2.6.32-754.17.1.el6.x86_64 #1 SMP Tue Jul 2 12:42:48 UTC 2019 x86_64
User: chuahuehuong (1863)
PHP: 7.3.16
Disabled: apache_note,apache_setenv,proc_get_status,exec,passthru,proc_nice,proc_terminate,shell_exec,system,ini_restore,syslog,define_syslog_variables,symlink,link,error_log,leak,dbmopen,closelog,stream_socket_server,execl,escapeshellcmd,ini_alter,dl,show_source,posix_getpwuid,posix_geteuid,posix_getegid,posix_getgrgid,open_basedir,safe_mode_include_dir,pcntl_exec,pcntl_fork,pclose,virtual,openlog,popen,escapeshellarg,eval,calo,posix_getpwuid,symlinks,symlink,getpwuid,mail
Upload Files
File: //etc/rc3.d/S55lsi_mrdsnmpd
#!/bin/sh
#chkconfig: 2345 55 80
#description: LSI SNMP Agent startup/shutdown script
#Source function library.
. /etc/init.d/functions   

megadevice="megasnmp"
agent="/usr/sbin/lsi_mrdsnmpagent"
agent_name="lsi_mrdsnmpagent"
pidfile="mrdsnmpd"
vendor="LSI SNMP"	
RETVAL=0
SNMPDCONF=/etc/snmp/snmpd.conf


#A function to stop a program.
statuscheck() {
	local base=${1}
	local pid

	# Test syntax.
	if [ "$#" = 0 ] ; then
		echo $"Usage: status {program}"
		return 1
	fi

	# First try "pidof"
	pid=`pidof -o $$ -o $PPID -o %PPID -x $1 || \
	     pidof -o $$ -o $PPID -o %PPID -x ${base}`
	if [ -n "$pid" ]; then
	        echo $"${base} (pid $pid) is running..."
	        return 0
	fi

	# Next try "/var/run/*.pid" files
	if [ -f /var/run/${base}.pid ] ; then
	        read pid < /var/run/${base}.pid
	        if [ -n "$pid" ]; then
	                echo $"${base} dead but pid file exists"
	                return 1
	        fi
	fi
	# See if /var/lock/subsys/${base} exists
	if [ -f /var/lock/subsys/${base} ]; then
		echo $"${base} dead but subsys locked"
		return 2
	fi
	echo $"${base} is stopped"
	return 3
}

mykillproc() 
{
	RC=0
	# Test syntax.
	if [ $# = 0 ]; then
		echo "Usage: killproc {program} [signal]"
		return 1
	fi

	notset=0
	# check for second arg to be kill level
	if [ "$2" != "" ] ; then
		killlevel=$2
	else
		notset=1
		killlevel="-9"
	fi

        # Save basename.
        base=`basename $1`

        # Find pid.
	pid=`pidof $1 | cut -f1 -d" "`	

        # Kill it.
        if [ "$pid" != "" ] ; then
                [ "$BOOTUP" = "verbose" ] && echo -n "$base "
		if [ "$notset" = "1" ] ; then
		       if ps h $pid >/dev/null 2>&1; then
			   # TERM first, then KILL if not dead
			   kill -TERM $pid
			   usleep 200000
			   if ps h $pid >/dev/null  >/dev/null 2>&1 ; then
				sleep 1
				if ps h $pid >/dev/null  >/dev/null 2>&1 ; then
				        sleep 3
					if ps h $pid >/dev/null  >/dev/null 2>&1 ; then
					   kill -KILL $pid
					   usleep 200000
					fi
				fi
			   fi
		        fi
			ps h $pid >/dev/null  >/dev/null 2>&1
			RC=$?
			[ $RC -eq 0 ] && failure "$base shutdown" || success "$base shutdown"
			RC=$((! $RC))
		# use specified level only
		else
		        if ps h $pid >/dev/null  >/dev/null 2>&1; then
	                	kill $killlevel $pid
				RC=$?
				[ $RC -eq 0 ] && success "$base $killlevel" || failure "$base $killlevel"
			fi
		fi
	else
	    failure "$base shutdown"
	fi

        # Remove pid file if any.
	if [ "$notset" = "1" ]; then
            rm -f /var/run/$base.pid
	fi
	return $RC
}


start()
{
	echo -n "Starting $vendor Agent:"
	spid=`pidof snmpd`
	agentpid=`pidof $agent`
	if [ "$agentpid" != "" ] ; then
				echo " is Already Running";
				return 0
	fi
	if [ "$spid" = "" ] ; then 
		if [ -x /etc/init.d/snmpd ] ; then 
			/etc/init.d/snmpd start
		elif [ -x /usr/local/sbin/snmpd ] ; then 
			/usr/local/sbin/snmpd
		else
			echo SNMP Daemon not started
		fi
	fi
	daemon ${agent} -c ${SNMPDCONF}
	echo
}

stop()
{
	echo -n "Stopping $vendor Agent:"
	killproc ${agent}
	echo
	return 0
}

case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  restart|reload)
	$0 stop
	$0 start
	;;
 status)
      
        statuscheck ${agent_name}
	RETVAL=$?
        ;;
  *)
	echo "$vendor Agent is not Started/Stopped"
      echo "Usage: $0 {start|stop|restart|status}"
	exit 1
esac

exit $RETVAL