5.1 and Pervasive SQL in Linux Emu (7) -> tty stopped output

From: Karl M. Joch <k.joch_at_kmjeuro.com>
Date: Sat, 26 Jul 2003 22:21:01 +0200
the following script starts psql without problems on 4.8 with linux base 
6. with 5.1 and linux base 7 it looks like su hangs. scripts doenst 
complete and ends with tty output stopped.

there is also something very strange: when starting pervasive in 
forground mode i get a listener and it works. when starting into 
background (manually without the following script) i dont get a listener 
opened. persavice thinks it is open, at least there is no entry in any 
log but netstat -rn doesnt show a listener.


#!/compat/linux/bin/sh
#
# description: Starts and stops the Pervasive mkded and sqlmgr daemons

# chkconfig: 2345 92 92

start_psql(){
	echo "Starting Pervasive services: "
	SQLID=`/bin/ps ax | grep -v grep | grep sqlmgr | awk '{print $1}'`
	BTRID=`/bin/ps ax | grep -v grep | grep mkded | awk '{print $1}'`
	if [ "X$BTRID" != "X" -o "X$SQLID" != "X" ] ; then
		echo Warning: the following service is running
		if [ "X$BTRID" != "X" ] ; then
			echo mkded
		fi
		if [ "X$SQLID" != "X" ] ; then
			echo sqlmgr
		fi
		echo
	fi
	echo mkded
	echo "cd $PVSW_ROOT/bin; . $PVSW_ROOT/bin/.bash_profile ; ./mkded 
-start" | /usr/bin/su - psql || exit 1
	echo sqlmgr
	echo "cd $PVSW_ROOT/bin; . $PVSW_ROOT/bin/.bash_profile ; ./sqlmgr 
-start" | /usr/bin/su - psql || exit 1
	touch /var/lock/subsys/psql
	echo ""
}

stop_psql(){
	echo "Shutting down Pervasive services: "
	SQLID=`/bin/ps ax | grep -v grep | grep sqlmgr | awk '{print $1}'`
	if [ "X$SQLID" != "X" ] ; then
		echo sqlmgr
		if [ -x /usr/local/psql/bin/sqlmgr ] ; then
			echo "cd $PVSW_ROOT/bin; . $PVSW_ROOT/bin/.bash_profile ; ./sqlmgr 
-stop"	| /usr/bin/su - psql
		else
			kill -9 $SQLID
		fi
	fi
	BTRID=`/bin/ps ax | grep -v grep | grep mkded | awk '{print $1}'`
	if [ "X$BTRID" != "X" ] ; then
		echo mkded
		if [ -x /usr/local/psql/bin/mkded ] ; then
			echo "cd $PVSW_ROOT/bin; . $PVSW_ROOT/bin/.bash_profile ; ./mkded 
-stop" | /usr/bin/su - psql
		else
			kill -9 $BTRID
		fi
	fi
	echo ""
	rm -f /var/lock/subsys/psql
}

force_psql(){
	if [ -x $PVSW_ROOT/bin/mkded ] ; then
		echo "Clearing Pervasive shared memory: "
		echo "cd $PVSW_ROOT/bin; . $PVSW_ROOT/bin/.bash_profile ; ./mkded 
-force" | /bin/su - psql
	fi

	# jme 27791
	MEMORY=`ipcs -m | grep psql | awk '{print $2}' | tr -d "psql "`
	if [ "X$MEMORY" != "X" ] ; then
		for i in $MEMORY ; do
			ipcrm shm $i
		done
	fi

	echo "Clearing semaphores: "
	SEMAFORES=`ipcs -s | grep psql | awk '{print $2}' | tr -d "psql "`
	if [ "X$SEMAFORES" != "X" ] ; then
		for i in $SEMAFORES ; do
			ipcrm sem $i
		done
	fi

	# ayahin: defect 33091
	SQLID=`/bin/ps ax | grep -v grep | grep sqlmgr | awk '{print $1}'`
	BTRID=`/bin/ps ax | grep -v grep | grep mkded | awk '{print $1}'`
	if [ "X$SQLID" != "X" ] ; then
		echo sqlmgr
		kill -9 $SQLID
	fi
	if [ "X$BTRID" != "X" ] ; then
		echo mkded
		kill -9 $BTRID
	fi

	echo ""
}

# Setting up environment
PVSW_ROOT=/usr/local/psql
PATH=$PVSW_ROOT/bin:$PATH
LD_LIBRARY_PATH=$PVSW_ROOT/lib
cd $PVSW_ROOT/bin

case "$1" in
   start)
	start_psql
	;;
   stop)
	stop_psql
	;;
   force)
	stop_psql
	force_psql
	;;
   restart)
	echo "Restarting Pervasive services: "
	stop_psql
	start_psql
	echo "done."
	;;
   *)
	echo "Usage: psql {start|stop|force|restart}"
	exit 1
esac
Received on Sat Jul 26 2003 - 11:21:20 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:16 UTC