#!/bin/bash # # edex_ldm: This starts and stops the LDM on EDEX # # chkconfig: 35 99 0 # description: edex_ldm starts/stops LDM software for AWIPS II # LDM_INSTALL="/awips2/ldm" PATH=/awips2/python/bin:/awips2/notification/bin:/awips2/java/bin:/awips2/tools/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:${LDM_INSTALL}/bin:${LDM_INSTALL}/decoders:${LDM_INSTALL}/util # Source function library. . /etc/init.d/functions RETVAL=0 LDM_USER=awips function create_queue() { if [[ ! -f ${LDM_INSTALL}/var/queues/ldm.pq ]] then echo -ne "\nCreating LDM queue:\t" su ${LDM_USER} -lc "ldmadmin mkqueue" > /dev/null 2>&1 && success || failure if [[ ${myRetVal} -ne 0 ]] then return ${myRetVal} fi echo fi return 0 } function clean_ldm() { echo -ne "Cleaning LDM:\t" su ${LDM_USER} -lc "ldmadmin clean" > /dev/null 2>&1 && success || failure myRetVal=$? if [[ ${myRetVal} -ne 0 ]] then return ${myRetVal} fi echo create_queue return 0 } case $1 in 'start') create_queue su ${LDM_USER} -lc "ldmadmin start" ;; 'stop') su ${LDM_USER} -lc "ldmadmin stop" ;; 'restart') su ${LDM_USER} -lc "ldmadmin restart" ;; 'clean') su ${LDM_USER} -lc "ldmadmin clean" ;; *) echo "usage: $0 {start|stop|restart|clean}" RETVAL=1 ;; esac exit $RETVAL