[comp.databases] nokill, graceful abort for Ingres 6.3 commands on Unix

sena@infinet.UUCP (Fred Sena) (01/10/91)

Hi,

Enclosed is a sh program called nokill.  It's pretty small (more comments
than code), but it comes in handy for working around an ingres "bug" (IMHO)
which dumps core in the event that you attempt to CTRL/C out of an ingres
command which pipes output into another unix command.

For example, if you type:

  $ echo 'select my_column from my_table \g' |sql my_database |more

and CTRL/C out of the command, then ingres will crash and dump core.  So, to
prevent this, you would type:

  $ echo 'select my_column from my_table \g' |sql my_database |nokill more

which has the effect of sheltering the 'more' command from the CTRL/C signal,
so the 'sql' command gets the signal and the command exits gracefully.

	enjoy,
	--fred		sena@infinet.UUCP

P.S. Have I posted this before...?  If so, I apologize.

-------------hack here-----------------------------------------------------

#!/bin/sh
#
# nokill - prevent command from being killed by a CTRL/C interrupt
#
# SYNOPSIS
#	nokill command
#
# DESCRIPTION
#    nokill prevents [command] from being killed by a CTRL/C interrupt by
#    trapping the signal SIGINT (2).
#
#    nokill passes the standard input into [command].
#
# HISTORY
#    nokill was created to work-around a bug in Ingres 6.3.  If an Ingres
#    command has an output (or input?) pipe into another unix command, and
#    the other command dies, the Ingres command gets an 'illegal instruction'
#    error and dumps core.  See the example below to see how nokill is used
#    to avoid this Ingres bug.
#
# EXAMPLE
#    Below is an example of how nokill can be used with the Ingres command
#    'copyform':
#
#	$ copyform -i -r my_database form_file | nokill sed -n '/Copied/p'
#


#set -x

if [ -z "$1" ]; then
	echo "usage: nokill command"
	exit 1
fi

trap '' 2

cat | $*


-- 
--------------------------------------------------
Frederick J. Sena                sena@infinet.UUCP
Memotec Datacom, Inc.  N. Andover, MA