/usr/sbin/refdbctl is in refdb-server 1.0.2-3ubuntu1.
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 | #!/bin/bash
#
# refdbctl: RefDB control script for starting, stopping, reconfiguring, and
# restarting of refdbd
# usage: refdbctl (start|stop|reload|restart)
# markus@mhoenicka.de 2001-7-22
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
  
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
  
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>
# NB we must use bash for "cd -" to work
# full path to the daemon binary
REFDBD='/usr/bin/refdbd'
# default full path of the file the daemon writes its PID to
PIDFILE='/run/refdbd.pid'
# the path of the global refdbd configuration file
globalconfig="/etc/refdb/refdbdrc"
if [ ! -r "$globalconfig" ] && [ -n "$REFDBLIB" ]; then
    globalconfig=$REFDBLIB/refdbdrc
fi
# read the settings in the configure file. We're only interested in
# nonstandard PID file settings
for config in $globalconfig; do
    while read refdbvar refdbval; do
	if [ -n "$refdbvar" ]; then
	    if [ $refdbvar = pidfile ]; then
		PIDFILE=$refdbval
	    fi
	fi
    done < $config
done
# default return value is 0 (all fine). Other values are: 1 (error),
# 2 (nothing to do), 3 (unknown or missing command)
RETVAL=0
# we need at least one argument (only the first one is used actually)
ARGV="$@"
if [ "x$ARGV" = "x" ] ; then 
    ARGS="help"
fi
# find the saved process ID (strip leading and trailing junk)
if [ -f $PIDFILE ]; then
    SAVEDPID=`cat $PIDFILE | sed 's/^ *\([0-9]*\).*/\1/'`
else
    SAVEDPID=#
fi
# make sure the process with this ID is an instance of refdbd
# NB run grep case-insensitive as some Windozes return uppercase process names
PID=`ps ax | grep -i "^ *$SAVEDPID.*[r]efdbd" | sed 's/^ *\([0-9]*\).*/\1/'`
# see whether the daemon is running
if [ "x$PID" != "x" ] ; then
    RUNNING=1
else
    RUNNING=0
fi
# in order to work around a sqlite bug on Windows/Cygwin, we have to
# start the daemon from the root directory (this does not hurt in any way).
# On Cygwin, the refdbdrc config file has to use the relative path starting
# from / to the database directory. On other systems you can use either
# the absolute or the relative path
case $1 in
    start)
	if [ $RUNNING -eq 1 ]; then
	    echo "$0 $1: $REFDBD already running (PID=$PID)"
	    RETVAL=2
	else
	    cd /
	    if $REFDBD ; then
		echo "$0 $1: bibliography tool application server started"
	    else
		echo "$0 $1: bibliography tool application server could not be started"
		RETVAL=1
	    fi
	    cd -
	fi;;
    stop)
	if [ $RUNNING -eq 0 ]; then
	    echo "$0 $1: $REFDBD is not running"
	    RETVAL=2
	else
	    if kill $PID ; then
		echo "$0 $1: bibliography tool application server stopped"
	    else
		echo "$0 $1: bibliography tool application server could not be stopped"
		RETVAL=1
	    fi
	fi;;
    reload)
	if [ $RUNNING -eq 0 ]; then
	    echo "$0 $1: $REFDBD is not running"
	    RETVAL=2
	else
	    if kill -HUP $PID ; then
		echo "$0 $1: bibliography tool application server reconfigured"
	    else
		echo "$0 $1: bibliography tool application server could not be reconfigured"
		RETVAL=1
	    fi
	fi;;
    restart)
	if [ $RUNNING -eq 0 ]; then
	    echo "$0 $1: $REFDBD is not running"
	    RETVAL=2
	else
	    if kill -TERM $PID ; then
		cd /
		if $REFDBD ; then
		    echo "$0 $1: bibliography tool application server restarted"
		else
		    echo "$0 $1: bibliography tool application server could not be restarted"
		    RETVAL=1
		fi
		cd -
	    else
		echo "$0 $1: bibliography tool application server could not be stopped"
		RETVAL=1
	    fi
	fi;;
    *)
	echo "usage: $0 (start|stop|reload|restart)"
	RETVAL=3;;
esac
exit $RETVAL
 |