Cover V11, I02

Article
Listing 1
Listing 2

feb2002.tar

Listing 2 Startup script for jptraveld

#!/bin/sh
# Startup script for jptraveld
#
# chkconfig: 2345 95 05
# description: start jp travel daemon

SVCDIR=/excite/daemon/jp/udbd/sct/travel
LOGGER=/bin/logger

USER=excited
SERVICE=travel

CULPRIT="$LOGNAME"
if [ -z "$CULPRIT" ]; then
        CULPRIT="Someone"
fi

cd $SVCDIR
if [ -d "$SVCDIR" ] ; then
        if [ "`/bin/tty`" != "not a tty" ]; then
                echo "telling $SERVICE to $1"
                echo
        fi

        $LOGGER -p daemon.notice -t $SERVICE "$CULPRIT told $SERVICE to $1"

        if [ "$1" = "restart" ]; then
                su - $USER -c "cd $SVCDIR; $SVCDIR/stop";
                sleep 3;
                su - $USER -c "cd $SVCDIR; $SVCDIR/start";
        fi

        if [ "$1" = "start" ]; then
                su - $USER -c "cd $SVCDIR; $SVCDIR/start";
        fi

        if [ "$1" = "stop" ]; then
                su - $USER -c "cd $SVCDIR; $SVCDIR/stop";
        fi

fi

if [ "`/bin/tty`" != "not a tty" ]; then
        sleep 1;
        echo
        echo "$SERVICE processes running:"
        /usr/ucb/ps auxww | /bin/egrep $USER | /bin/egrep 'univdbd *-port \
   *90054' | /bin/egrep -v grep
        echo
        /bin/netstat -na | /bin/egrep LISTEN | /bin/egrep '90054|24518' | \ 
   /bin/egrep -v grep
        echo
fi

exit 0;

# __END__