This file is indexed.

/usr/bin/svinfo is in svtools 0.6-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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
#!/bin/sh
#
# svinfo
# Get infos about a supervised process
# Klaus Reimer <k@ailis.de>

TITLE=svinfo
VERSION=0.6
AUTHOR="Klaus Reimer"
EMAIL=k@ailis.de
COPYRIGHT="Copyright (C) 2000-2011 by $AUTHOR"

showHelp() {
  echo "Usage: $TITLE [OPTION]... SERVICE"
  echo "Get infos about a supervised process"
  echo ""
  echo "  -l, --log      Get infos about the attached log process instead of"
  echo "                 the process itself"
  echo "  -w, --when     Output the time when the service was started"
  echo "  -p, --pid      Output the process id of the service (0 if not running)"
  echo "  -s, --state    Return the process state"
  echo "                   0=down and stopped,"
  echo "                   1=up and stopped,"
  echo "                   2=down and started,"
  echo "                   3=up and started"
  echo "  -h, --help     Display help and exit"
  echo "  -V, --version  Display version and exit"
  echo ""
  echo "With this utility you can gather some information about a"
  echo "supervised process. If no parameters are specified this utility"
  echo "prints the status output from svstat."
  echo ""
  echo "Report bugs to $AUTHOR <$EMAIL>"
}

showVersion() {
  echo "$TITLE $VERSION"
  echo ""
  echo "$COPYRIGHT"
  echo "This is free software; you can redistribute it and/or modify it under"
  echo "the terms of the GNU General Public License as published by the Free"
  echo "Software Foundation; either version 2 of the License, or (at your"
  echo "option) any later version."
}

while getopts "lpwshV-:" NAME
do
  case "$NAME" in
    l)
      LOG="1"
      ;;
    p)
      MODE="PID"
      ;;
    w)
      MODE="WHEN"
      ;;
    s)
      MODE="STATE"
      ;;
    h)
      showHelp
      exit 0
      ;;
    V)
      showVersion
      exit 0
      ;;
    -)
      case "$OPTARG" in
        log)
          LOG="1"
          ;;
        pid)
          MODE="PID"
          ;;
        when)
          MODE="WHEN"
          ;;
        state)
          MODE="STATE"
          ;;
        help)
          showHelp
          exit 0
          ;;
        version)
          showVersion
          exit 0
          ;;
        *)
          echo "Unknown option: $OPTARG"
          showHelp
          exit 1
      esac  
      ;;
    *)
      echo "Unknown option: $OPTARG"
      showHelp
      exit 1
  esac
done

shift `expr $OPTIND - 1`
if [ $# -ne 1 ]
then
  showHelp
  exit 1
fi

if ! SVDIR=`svdir 2>&1`
then
  echo "$TITLE: $SVDIR" >&2
  exit 1
fi

SERVICE=$1

svok $SVDIR/$SERVICE || exit 1
if [ "$LOG" = "1" ]
then
  svok $SVDIR/$SERVICE/log || exit 1
fi

case "$MODE" in
  PID)
    if [ "$LOG" = "1" ]
    then
      hexdump -e '"%d\n"' -s 12 -n 4 /$SVDIR/$SERVICE/log/supervise/status
    else
      hexdump -e '"%d\n"' -s 12 -n 4 /$SVDIR/$SERVICE/supervise/status
    fi
    ;;
  WHEN)
    if [ "$LOG" = "1" ]
    then
      hexdump -e '"@" 12 1 "%02x" "\n"' -s 0 -n 12 /$SVDIR/$SERVICE/log/supervise/status | tai64nlocal
    else
      hexdump -e '"@" 12 1 "%02x" "\n"' -s 0 -n 12 /$SVDIR/$SERVICE/supervise/status | tai64nlocal
    fi
    ;;
  STATE)
    if [ "$LOG" = "1" ]
    then
      PID=`hexdump -e '"%d\n"' -s 12 -n 4 /$SVDIR/$SERVICE/log/supervise/status`
      FILE="$SVDIR/$SERVICE/log/down"
    else
      PID=`hexdump -e '"%d\n"' -s 12 -n 4 /$SVDIR/$SERVICE/supervise/status`
      FILE="$SVDIR/$SERVICE/down"
    fi
    if [ -f $FILE ]
    then
      if [ $PID -ne 0 ]
      then
        echo "Service is force-started"
        exit 2
      else
        echo "Service is disabled"
        exit 0
      fi
    else
      if [ $PID -ne 0 ]
      then
        echo "Service is started"
        exit 3
      else
        echo "Service is stopped"
        exit 1
      fi
    fi
    ;;
  *)
    if [ "$LOG" = "1" ]
    then
      svstat $SVDIR/$SERVICE/log
    else
      svstat $SVDIR/$SERVICE
    fi
    ;;
esac

exit 0