Gentoo Archives: gentoo-commits

From: "Caleb Tennis (caleb)" <caleb@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in net-misc/memcached/files/1.2.6: conf init
Date: Fri, 01 Aug 2008 15:56:59
Message-Id: E1KOwzw-0006Kg-GY@stork.gentoo.org
1 caleb 08/08/01 15:56:56
2
3 Added: conf init
4 Log:
5 bump to new version
6 (Portage version: 2.1.5.2)
7 (Unsigned Manifest commit)
8
9 Revision Changes Path
10 1.1 net-misc/memcached/files/1.2.6/conf
11
12 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/memcached/files/1.2.6/conf?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/memcached/files/1.2.6/conf?rev=1.1&content-type=text/plain
14
15 Index: conf
16 ===================================================================
17 # Copyright 2003 Gentoo Technologies, Inc
18 # $Header: /var/cvsroot/gentoo-x86/net-misc/memcached/files/1.2.6/conf,v 1.1 2008/08/01 15:56:55 caleb Exp $
19 # memcached config file
20
21 MEMCACHED_BINARY="/usr/bin/memcached"
22
23 #Specify memory usage in megabytes (do not use letters)
24 #64MB is default
25 MEMUSAGE="64"
26
27 #User to run as
28 MEMCACHED_RUNAS="memcached"
29
30 #Specify maximum number of concurrent connections
31 #1024 is default
32 MAXCONN="1024"
33
34 #Listen for connections on what address?
35 # If this is empty, memcached will listen on 0.0.0.0
36 # be sure you have a firewall in place!
37 LISTENON=""
38
39 #Listen for connections on what port?
40 PORT="11211"
41
42 #PID file location
43 # '-${PORT}.${CONF}.pid' will be appended to this!
44 # You do not normally need to change this.
45 PIDBASE="/var/run/memcached/memcached"
46
47 #Other Options
48 MISC_OPTS=""
49
50
51
52 1.1 net-misc/memcached/files/1.2.6/init
53
54 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/memcached/files/1.2.6/init?rev=1.1&view=markup
55 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-misc/memcached/files/1.2.6/init?rev=1.1&content-type=text/plain
56
57 Index: init
58 ===================================================================
59 #!/sbin/runscript
60 # $Header: /var/cvsroot/gentoo-x86/net-misc/memcached/files/1.2.6/init,v 1.1 2008/08/01 15:56:55 caleb Exp $
61
62 CONF="${SVCNAME#*.}"
63 CONFBASE="/etc/conf.d/memcached"
64
65 [ -z "${PIDBASE}" ] && PIDBASE="/var/run/memcached/memcached"
66 [ "${CONF}" == "memcached" ] && CONF=''
67
68 if [ -n "${CONF}" ]; then
69 PIDFILE="${PIDBASE}-${PORT}.${CONF}.pid"
70 CONFSRC="${CONFBASE}.${CONF}"
71 if [ -f "${CONFSRC}" ]; then
72 source "${CONFSRC}"
73 else
74 eerror "The configuration file $CONFSRC was not found!"
75 fi
76 else
77 PIDFILE="${PIDBASE}-${PORT}.pid"
78 CONFSRC="${CONFBASE}"
79 fi
80
81 depend() {
82 need net
83 }
84
85 checkconfig() {
86 if [ -z "${LISTENON}" ]; then
87 ewarn "You should edit $CONFSRC and specify an address to listen on."
88 ewarn "Listening on any address (check your firewall!)"
89 fi
90
91 }
92
93 start() {
94 if [ -n "${CONF}" ]; then
95 ebegin "Starting memcached (${CONF})"
96 else
97 ebegin "Starting memcached"
98 fi
99 checkconfig
100 local dir="$(dirname ${PIDFILE})"
101 if [ ! -d "${dir}" ]; then
102 einfo " Creating ${dir}"
103 mkdir -p "${dir}"
104 fi
105 chown ${MEMCACHED_RUNAS} "${dir}"
106 if [ -f "${PIDFILE}" ]; then
107 einfo " Removing stale pidfile ${PIDFILE}"
108 rm -f "${PIDFILE}" 1>/dev/null
109 fi
110
111 if [ -z "${LISTENON}" ]; then
112 c_LISTENON=""
113 else
114 c_LISTENON="-l ${LISTENON}"
115 fi
116
117 /sbin/start-stop-daemon --start --pidfile "${PIDFILE}" \
118 --exec "${MEMCACHED_BINARY}" \
119 --startas "${MEMCACHED_BINARY}" -- \
120 -d -p ${PORT} ${c_LISTENON} -m ${MEMUSAGE} \
121 -c ${MAXCONN} -u ${MEMCACHED_RUNAS} -P "${PIDFILE}" \
122 ${MISC_OPTS}
123 eend $?
124 }
125
126 stop() {
127 if [ -n "${CONF}" ]; then
128 ebegin "Stopping memcached (${CONF})"
129 else
130 ebegin "Stopping memcached"
131 fi
132 start-stop-daemon --stop --quiet --pidfile "${PIDFILE}"
133 rm -f "${PIDFILE}"
134 eend $?
135 }