#!/bin/sh
onepid=$1
ksig=$2
if [ -z "$onepid" ]
then
	exit 0
fi
test -z "$ksig" && ksig=15
#
if [ $onepid -le 100 ]
then
	exit 0
fi
timelimit=5
wcnt=0
while [ : ]
do
	if [ "$ksig" = '0' ]
		then
		kill -${ksig} $onepid 2>/dev/null
		exit $?
	fi
	kill -${ksig} $onepid 2>/dev/null
	test $? -ne 0 && exit 0
	let wcnt=$wcnt+1
	test $wcnt -gt $timelimit && break
	sleep 1
done
kill -9 $onepid 2>/dev/null
test $? -eq 0 && exit 1
exit 0
#