imip-agent

tests/resource_request.sh

1050:96f9567b0a99
2016-02-08 Paul Boddie With quotas, reject indefinitely recurring events, allowing rule-based events.
     1 #!/bin/sh     2      3 THIS_DIR=`dirname $0`     4      5 TEMPLATES="$THIS_DIR/templates"     6 RESOURCE_SCRIPT="$THIS_DIR/../imip_resource.py"     7 SHOWMAIL="$THIS_DIR/../tools/showmail.py"     8 STORE=/tmp/store     9 STATIC=/tmp/static    10 PREFS=/tmp/prefs    11 JOURNAL=/tmp/journal    12 ARGS="-S $STORE -P $STATIC -p $PREFS -j $JOURNAL -d"    13     14 ERROR=err.tmp    15     16 export N=$1    17 export START=20141126T090000    18 export END=20141126T100000    19 export SENDERADDRESS="person-$N@example.com"    20 export SENDER="mailto:person-$N@example.com"    21     22 # Exit if a previous result indicates acceptance of a request.    23     24    [ -e "outP${N}.tmp" ] \    25 && `grep 'PARTSTAT' "outP${N}.tmp" | grep -q 'ACCEPTED'` \    26 && exit 0    27     28 FBRESULT=$2    29     30 # Find the end of a busy period or use the initial start.    31     32 FBSTART=`grep 'FREEBUSY' "$FBRESULT" | grep -v 'VFREEBUSY' | tail -n 1 | cut -d: -f2 | cut -d/ -f2 | tr -d '\\r'`    33 FBEND=`python "$THIS_DIR/next_time.py" "$FBSTART" 09 16`    34 START=${FBSTART:-$START}    35 END=${FBEND:-$END}    36     37 echo "Try for $N with $START and $END..."    38     39 # Request a resource on behalf of a numbered person identity.    40     41   envsubst < "$TEMPLATES/event-request-group.txt" \    42 | tee "inP${N}.tmp" \    43 | "$RESOURCE_SCRIPT" $ARGS 2>> $ERROR \    44 | "$SHOWMAIL" 2>> $ERROR \    45 > "outP${N}.tmp"