#!/bin/sh
#
# @(#)rtraceon.sh	8.7 8.7 93/11/17 Copyright 1986-1993 SMI
#
# Copyright (c) 1991 Sun Microsystems, Inc.  All Rights Reserved.
# Sun considers its source code as an unpublished, proprietary trade
# secret, and it is available only under strict license provisions.
# This copyright notice is placed here only to protect Sun in the event
# the source is deemed a published work.  Dissassembly, decompilation,
# or other means of reducing the object code to human readable form is
# prohibited by the license agreement under which this code is provided
# to the user or company in possession of this copy.
#
# RESTRICTED RIGHTS LEGEND: Use, duplication, or disclosure by the
# Government is subject to restrictions as set forth in subparagraph
# (c)(1)(ii) of the Rights in Technical Data and Computer Software
# clause at DFARS 52.227-7013 and in similar clauses in the FAR and
# NASA FAR Supplement.

#


idname=`id | awk '{proc = substr($0, 7, 4);
	if (proc == "root") print proc}'`
	 
if [ "$idname" != "root" ]
then
        echo "You must be root to run this script."
        exit 1
fi

PATH=/sbin:/usr/sbin:/bin:/usr/bin:/etc:/usr/etc
export PATH

if [ $# != 1 ]
then
	echo "usage: rjetraceon <gateway>"
        echo "rjetraceon will turn on <gateway> devtrace and hosttrace"
	exit 1
fi

gateway=$1
psid=`ps -ef | awk 'NF >= 1 { if (($(NF-1) == "./sna3770" || $(NF-1) == "sna3770")  && $(NF) == gateway) print $2}' gateway=$1`

if [ "$psid" = "" ]
then
	echo "rjetraceon: no gateway \"$1\" found"
        exit 1
fi

kill -16 $psid
