/usr/lib/condor/libexec/condor_schedd.init 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 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 | #!/bin/bash
# This control script is a modified version of the condor init script
# developed by Matt Farrellee. The main differences are that it controls
# the schedd instead of master, there is no lockfile, and all echo
# statements have been removed.
# The program being managed
prog=condor_schedd
pidfile=/var/run/condor/$prog.pid
# Source function library
. /etc/init.d/functions
# Source networking configuration
[ -f /etc/sysconfig/network ] && . /etc/sysconfig/network
# Source Condor configuration
[ -f /etc/sysconfig/condor ] && . /etc/sysconfig/condor
# Check that networking is up
[ "${NETWORKING}" = "no" ] && exit 1
start() {
pid_status $pidfile
if [ $? -ne 0 ]; then
rm -f $pidfile
fi
daemon --pidfile $pidfile --check $prog $prog -pidfile $pidfile
RETVAL=$?
return $RETVAL
}
stop() {
killproc -p $pidfile $prog -QUIT
RETVAL=$?
wait_pid $pidfile 15
if [ $? -ne 0 ]; then
RETVAL=1
fi
return $RETVAL
}
#
# Determine if a process is running only by looking in a pidfile.
# There is no use of pidof, which can find processes that are not
# started by this script.
#
# ASSUMPTION: The pidfile will exist if the process does, see false
# negative warning.
#
# WARNING: A false positive is possible if the process that dropped
# the pid file has crashed and the pid has been recycled. A false
# negative is possible if the process has not yet dropped the pidfile,
# or it contains the incorrect pid.
#
# Usage: pid_status <pidfile>
# Result: 0 = pid exists
# 1 = pid does not exist, but pidfile does
# 2 = pidfile does not exist, thus pid does not exist
# 3 = status unknown
#
pid_status() {
pid=$(get_pid $1)
case $? in
1) return 2 ;;
2) return 3 ;;
esac
ps $pid &>/dev/null
if [ $? -ne 0 ]; then
return 1
fi
return 0
}
#
# Wait for the pid in the pidfile to disappear, but only do so for at
# most timeout seconds.
#
# Usage: wait_pid <pidfile> <timeout>
# Result: 0 = pid was not found (doesn't exist or not accessible)
# 1 = pid still exists after timeout
wait_pid() {
pid=$(get_pid $1)
if [ $? -ne 0 ]; then
return 0
fi
wait=0
while [ $wait -lt $2 ]; do
pid_status $1
if [ $? -ne 0 ]; then
return 0
fi
sleep 1
wait=$((wait + 1))
done
return 1
}
#
# Retrieve pid from a pidfile
#
# Usage: get_pid <pidfile>
# Result: 0 = pid returned
# 1 = pidfile not found
# 2 = pidfile not accessible or didn't contain pid
# Stdout: pid
#
get_pid() {
if [ -s $1 ]; then
pid=`cat $1` &>/dev/null
if [ $? -ne 0 -o -z "$pid" ]; then
return 2
fi
echo -n $pid
return 0
fi
return 1
}
pid_status $pidfile
running=$?
if [ "$1" != "status" -a "$1" != "stop" ]; then
# Report that $prog does not exist, or is not executable
if [ ! -x /usr/sbin/$prog ]; then
exit 5
fi
[ $running -eq 4 ] && exit 7
fi
case "$1" in
start)
[ $running -eq 0 ] && exit 0
start
RETVAL=$?
;;
stop)
[ $running -eq 0 ] || exit 0
stop
RETVAL=$?
;;
status)
if [ $running -ne 0 ]; then
exit $running
fi
# WARNING: status uses pidof and may find more pids than it
# should.
status -p $pidfile $prog
RETVAL=$?
;;
*)
RETVAL=2
esac
exit $RETVAL
|