#!/bin/csh -f
#*****************************************************************************
#                                                                            *
#            Copyright (C) 1993, Alias Research, Inc.                        *
#                                                                            *
#    These coded instructions,  statements and  computer programs contain    *
#    unpublished information proprietary to Alias Research, Inc.  and are    *
#    protected by the Canadian and US Federal copyright law. They may not    *
#    be disclosed to third parties  or copied  or duplicated, in whole or    *
#    in part,  without the prior written consent of Alias Research,  Inc.    *
#                                                                            *
# Unpublished-rights reserved under the Copyright Laws of the United States. *
#                                                                            *
#****************************************************************************/
#
#       $Source: /tmp_mnt/repo/root/v/alias3.2.2/srcChanges/CD2/Gifts/bin/RCS/drender_unlock.csh.sgi,v $
#       $Author: edirks $ $Date: 93/09/23 14:28:55 $
#
#

if (! $?ALIAS_LOCATION ) then
    echo "ALIAS_LOCATION environment variable must be set to install drender"
    exit -1
else
    set NT_DR=${ALIAS_WORKENV}/user_data/demo/misc_data/dlock.pst

    pst ${NT_DR}
    if ( $status == "1" ) then
        exit 1
    endif

    set NT_MACHINES=(`pstget ${NT_DR} '*.hosts' 'all'`)

    umask 000

    pushd ${NT_MASTER_DIR}/config > /dev/null

    if ( "${NT_MACHINES}" == "all" || "${NT_MACHINES}" == "ALL" || "${NT_MACHINES}" == "" ) then
        set NT_FILTER='*.locked'
        set NT_EXT=""
    else
        set NT_FILTER="${NT_MACHINES}"
        set NT_EXT=".locked"
    endif

    foreach mach ( ${NT_FILTER} )

        if ( "${mach}" == "localhost" ) then

            set machn=`hostname`
        else

            set machn=${mach}
        endif

        set machn2=${machn}${NT_EXT}

        if (-e ${NT_MASTER_DIR}/config/${machn2} ) then
            /bin/rm ${NT_MASTER_DIR}/config/${machn2}
        endif

        echo "${machn} now free to run jobs"
    end
    popd > /dev/null
endif


   
