1 Reply Latest reply: Nov 28, 2012 4:19 AM by Mohamed Ali Dhifallah RSS

Problem starting GateIn 3.2 as service in Redhat

Thomas Chacko Newbie

hi.

   I am trying to make GateIn 3.2 a service. To do so, I just created a file(gateinservice in etc/init.d) with content as follows :

 

#!/bin/sh

#

#

#

# chkconfig: 2345 98 02

# description: This is a daemon for automatically

# start my service

#

# processname: gateinservice

#

# pidfile: /var/run/gateinservice/gateinservice.pid

# Source function library.

. /etc/rc.d/init.d/functions

 

prefix=/usr

exec_prefix=/usr

sbindir=/usr/sbin

SCRIPT_BASE=/home/ABC/GateIn-3.2.0/bin

SCRIPT_LOG_LOCATION=/home/ABC/GateIn-3.2.0/log

START_UP_LOG=${SCRIPT_LOG_LOCATION}/startup

SHUT_DOWN_LOG=${SCRIPT_LOG_LOCATION}/shutdown

pidfile=/var/run/gateinservice/gateinservice.pid

# Sanity checks.

 

# so we can rearrange this easily

 

RETVAL=0

 

start()

{

echo "Starting my service "

echo " log location is:" ${START_UP_LOG}

${SCRIPT_BASE}/run.sh>>${START_UP_LOG}

echo "Done starting my service! "

 

}

 

stop()

{

 

echo "Stopping my service "

echo " log location is:" ${SHUT_DOWN_LOG}

${SCRIPT_BASE}/shutdown.sh>>${SHUT_DOWN_LOG}

echo "Done stopping my service! "

 

}

 

# See how we were called.

case "$1" in

start)

start

;;

stop)

stop

;;

status)

status -p $pidfile $processname

RETVAL=$?

;;

restart)

stop

start

;;

condrestart)

if [ -f /var/lock/subsys/$servicename ]; then

stop

start

fi

;;

*)

echo $"Usage: $0 {start|stop|status|restart|condrestart}"

;;

esac

exit $RETVAL

 

   GateIn was started successfully. But on checking the status of gateinservice using the command ' service gateinservice status', I'm getting 'is stopped'. why is it so ?