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
|
#!/usr/bin/env bash
PORT=19191
if [ $MC_PORT ]; then
PORT=$MC_PORT
fi
MAXCONN=1024
CACHESIZE=1024
OPTIONS=""
startup()
{
memcached -d -p $PORT -m $CACHESIZE -c $MAXCONN -U 0 -P /tmp/memc.pid.$PORT
}
shutdown()
{
if [ -f /tmp/memc.pid.$PORT ]
then
kill -9 `cat /tmp/memc.pid.$PORT`
rm /tmp/memc.pid.$PORT
fi
}
restart()
{
shutdown
startup
}
# See how we were called.
case "$1" in
start)
startup
;;
stop)
shutdown
;;
restart|reload)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart|reload}"
exit 1
esac
exit $?
|