##                               -*- Tcl -*-
## $Id: sched_init,v 1.1 1999/04/16 00:06:03 hender Exp $
## Amos Gouaux, Jan 1997
## Mainly this init file is to initialize the exempt array.

## Location of exceptions file
set db /var/spool/pbs/sched_priv/intrctv.allow

## Syslogger routine.
proc log {str} {
    if [catch [list exec /usr/ucb/logger \
            -t pbs_sched -p daemon.notice $str] res] {
        puts "Unable to use logger: $res"
        puts $str
    }
}

## Now read in values to exempt array.  Those in the exempt 
## array will be allowed to run interactive jobs.
log "Reading $db"
if [catch "open $db r" fd] {
    log "Unable to open $db: $fd"
    return
}
while {[gets $fd ulimit] != -1} {
    if {[regexp {^([^=]*)=([:0-9]*).*$} $ulimit {} user limit] > 0} {
        set exempt($user) $limit
        log "Interactive use enabled for $user ($limit)"
    } else {
        log "Invalid entry: $ulimit"
    }
}
close $fd

## $Source: /u/pbs1/RELEASE_TREE_CVS/pbs/src/scheduler.tcl/sample_scripts/UTDallas/sched_init,v $
