This file is indexed.

/etc/init.d/memcached is in memcached 1.4.21-1.1+deb8u2.

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
#! /bin/bash
### BEGIN INIT INFO
# Provides:            memcached
# Required-Start:      $remote_fs $syslog
# Required-Stop:       $remote_fs $syslog
# Should-Start:                $local_fs
# Should-Stop:         $local_fs
# Default-Start:       2 3 4 5
# Default-Stop:                0 1 6
# Short-Description:   Start memcached daemon
# Description:         Start up memcached, a high-performance memory caching daemon
### END INIT INFO

# Usage:
# cp /etc/memcached.conf /etc/memcached_server1.conf
# cp /etc/memcached.conf /etc/memcached_server2.conf
# start all instances:
# /etc/init.d/memcached start
# start one instance:
# /etc/init.d/memcached start server1
# stop all instances:
# /etc/init.d/memcached stop
# stop one instance:
# /etc/init.d/memcached stop server1
# There is no "status" command.

PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/bin/memcached
DAEMONNAME=memcached
DAEMONBOOTSTRAP=/usr/share/memcached/scripts/start-memcached
DESC=memcached

test -x $DAEMON || exit 0
test -x $DAEMONBOOTSTRAP || exit 0

set -e

. /lib/lsb/init-functions

# Edit /etc/default/memcached to change this.
ENABLE_MEMCACHED=no
test -r /etc/default/memcached && . /etc/default/memcached


FILES=(/etc/memcached_*.conf)
# check for alternative config schema
if [ -r "${FILES[0]}" ]; then
  CONFIGS=()
  for FILE in "${FILES[@]}";
  do
    # remove prefix
    NAME=${FILE#/etc/}
    # remove suffix
    NAME=${NAME%.conf}

    # check optional second param
    if [ $# -ne 2 ];
    then
      # add to config array
      CONFIGS+=($NAME)
    elif [ "memcached_$2" == "$NAME" ];
    then
      # use only one memcached
      CONFIGS=($NAME)
      break;
    fi;
  done;

  if [ ${#CONFIGS[@]} == 0 ];
  then
    echo "Config not exist for: $2" >&2
    exit 1
  fi;
else
  CONFIGS=(memcached)
fi;

er_or=0
CONFIG_NUM=${#CONFIGS[@]}
for ((i=0; i < $CONFIG_NUM; i++)); do
  NAME=${CONFIGS[${i}]}
  PIDFILE="/var/run/${NAME}.pid"

case "$1" in
  start)
       echo -n "Starting $DESC: "
       if [ $ENABLE_MEMCACHED = yes ]; then
            start-stop-daemon --start --quiet --exec "$DAEMONBOOTSTRAP" -- /etc/${NAME}.conf $PIDFILE
            echo "$NAME."
       else
            echo "$NAME disabled in /etc/default/memcached."
       fi
       ;;
  stop)
       echo -n "Stopping $DESC: "
       start-stop-daemon --stop --quiet --oknodo --retry 5 --pidfile $PIDFILE --exec $DAEMON
       echo "$NAME."
       rm -f $PIDFILE
       ;;

  restart|force-reload)
       #
       #       If the "reload" option is implemented, move the "force-reload"
       #       option to the "reload" entry above. If not, "force-reload" is
       #       just the same as "restart".
       #
       echo -n "Restarting $DESC: "
       start-stop-daemon --stop --quiet --oknodo --retry 5 --pidfile $PIDFILE
       rm -f $PIDFILE
       if [ $ENABLE_MEMCACHED = yes ]; then
       		start-stop-daemon --start --quiet --exec "$DAEMONBOOTSTRAP" -- /etc/${NAME}.conf $PIDFILE
       		echo "$NAME."
       else
            echo "$NAME disabled in /etc/default/memcached."
       fi
       ;;
  status)
       status_of_proc -p $PIDFILE $DAEMON $NAME
       returnvalue=$(echo $?)
       if [ "$returnvalue" -ne "0" ]
       then
            er_or=$(expr $er_or \+ 1)
       fi
       ;;
  *)
	N=/etc/init.d/$NAME
	echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
	exit 1
	;;
esac
done;

if [ "$er_or" -ne "0" ]
then
	exit 2
else
	exit 0
fi