Demo Discussion
Forum Config Examples Contributions Vulnerabilities
  Contributions to ELOG  Not logged in ELOG logo
Message ID: 9     Entry time: Wed Jul 7 18:19:10 2004
Author: Steve Jones 
Author Email: steve.jones@freescale.com 
Category: Script 
Subject: Generic Unix elogd init script 
Status: Stable 
Last Revision: Wed Jul 7 18:19:38 2004 by Steve Jones 
The elogd.init script that ships in the elog distribution is Linux centric.
 This script is written to work in a generic Unix environment under 'sh' -
no frills!
Attachment 1: elogd.init  1 kB  | Hide | Hide all
#!/bin/sh

# description: Start elog
# elog can have multiple instances run on the same server, pointing to different logbook areas.  This start
# script should be run from the root of each different elog area.

ELOGD="/_TOOLS_/dist/gnu-elog-2.5.3/sparc-sun-solaris2.8/bin/elogd"
ELOGDIR="/proj/sysadmin/ess/www/elog"
HOSTNAME=`hostname`

# Check for the config file
if [ ! -f $ELOGDIR/elogd.cfg ]; then
    exit 0
fi


# See how we were called.
case "$1" in
  start)
        if [ -f $ELOGDIR/elogd-$HOSTNAME.pid ] ; then
	   pid=`cat ./elogd-$HOSTNAME.pid`
	   if [ -d /proc/$pid ] ; then
	     echo "elogd already running"
	     exit 1
	   fi
	fi
####################################
# The full path *must* be specified
	echo "Starting elogd: "
	$ELOGD -f $ELOGDIR/elogd-$HOSTNAME.pid -c $ELOGDIR/elogd.cfg -D  > /dev/null 2>&1 &
	RETVAL=$?
        if [ $RETVAL -eq 0  ] ; then 
          echo "elog started" 
        else
          echo "Failed to start elog"
        fi
	echo
	;;
  stop)
     echo ""
      if [ -f $ELOGDIR/elogd-$HOSTNAME.pid ] ; then
        echo "Stopping elogd: "
        kill `cat $ELOGDIR/elogd-$HOSTNAME.pid`
	rm -f $ELOGDIR/elogd-$HOSTNAME.pid
        echo "elog stopped"
        echo
     else
        echo "No elogd running?"
	echo "Failed to start elog"
	echo
     fi
     
	;;
  restart|reload)
	$0 stop
	$0 start
	;;
  *)
	echo "Usage: $0 {start|stop|restart}"
	exit 1
esac

exit 0

ELOG V3.1.5-fe60aaf