This file is indexed.

/usr/bin/condor_router_q is in htcondor 8.6.8~dfsg.1-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
#!/bin/sh
##**************************************************************
##
## Copyright (C) 1990-2007, Condor Team, Computer Sciences Department,
## University of Wisconsin-Madison, WI.
## 
## Licensed under the Apache License, Version 2.0 (the "License"); you
## may not use this file except in compliance with the License.  You may
## obtain a copy of the License at
## 
##    http://www.apache.org/licenses/LICENSE-2.0
## 
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
##**************************************************************

PrintUsage() {
  echo "USAGE: $0 [router_q options] [condor_q options]"
  echo
  echo "This is a convenience wrapper around condor_q for viewing"
  echo "jobs being managed by the condor job router."
  echo
  echo "router_q options:"
  echo "  -S             summarize state of jobs on each route"
  echo "  -R             summarize running jobs on each route"
  echo "  -I             summarize idle jobs on each route"
  echo "  -H             summarize held jobs on each route"
  echo "  -route <name>  show only jobs on specified route"
  echo "  -idle          show only idle jobs"
  echo "  -held          show only held jobs"
  echo "  -constraint X  show jobs matching specified constraint"
  echo
  echo "Usage for condor_q follows:"
  condor_q -h
}

CONSTRAINT='RouteName =!= UNDEFINED'
show_route_summary=0
while true; do
  if [ "$1" = "-S" ]; then
    show_route_summary=1
    shift
  elif [ "$1" = "-R" ]; then
    show_route_summary=1
    CONSTRAINT="$CONSTRAINT && JobStatus == 2"
    shift
  elif [ "$1" = "-I" ]; then
    show_route_summary=1
    CONSTRAINT="$CONSTRAINT && JobStatus != 2"
    shift
  elif [ "$1" = "-H" ]; then
    show_route_summary=1
    CONSTRAINT="$CONSTRAINT && JobStatus == 5"
    shift
  elif [ "$1" = "-idle" ]; then
    CONSTRAINT="$CONSTRAINT && JobStatus == 1"
    shift
  elif [ "$1" = "-held" ]; then
    CONSTRAINT="$CONSTRAINT && JobStatus == 5"
    shift
  elif [ "$1" = "-constraint" ]; then
    CONSTRAINT="$CONSTRAINT && ($2)"
    shift
    shift
  elif [ "$1" = "-route" ] || [ "$1" = "-site" ]; then
    shift
    CONSTRAINT="$CONSTRAINT && RouteName =?= \"$1\""
    shift
  elif [ "$1" = "-h" ] || [ "$1" = "-help" ]; then
    PrintUsage
    exit 0
  else
    break
  fi
done

SECOND_FLAG=
if condor_config_val JOB_ROUTER_SCHEDD2_NAME 2>&1 > /dev/null; then
	SECOND_SCHEDD=`condor_config_val JOB_ROUTER_SCHEDD2_NAME 2> /dev/null`
	SECOND_FLAG="-name ${SECOND_SCHEDD} "
fi

if condor_config_val JOB_ROUTER_SCHEDD2_POOL 2>&1 > /dev/null; then
	SECOND_POOL=`condor_config_val JOB_ROUTER_SCHEDD2_POOL 2> /dev/null`
	SECOND_FLAG="$SECOND_FLAG -pool ${SECOND_POOL}"
fi

if [ "$show_route_summary" = "1" ]; then
  awk 'BEGIN {printf("%7s %2s %-20s %s\n","JOBS","ST","Route","GridResource")}'
  condor_q ${SECOND_FLAG} -constraint "$CONSTRAINT" -f "%s," JobStatus -f "%s," RouteName -f "%s" GridResource -f "\n" eol |
    awk -F, '{
      jobstatus=$1;
      if(jobstatus == 0) jobstatus = "U";
      if(jobstatus == 1) jobstatus = "I";
      if(jobstatus == 2) jobstatus = "R";
      if(jobstatus == 3) jobstatus = "X";
      if(jobstatus == 4) jobstatus = "C";
      if(jobstatus == 5) jobstatus = "H";
      if(jobstatus == 6) jobstatus = "E";
      printf("%2s %-20s %s\n",jobstatus,$2,$3);
    }' | sort | uniq -c | sort -k 3
  exit 0
fi

condor_q -constraint "$CONSTRAINT" "$@"