-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
1,265 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
#!/bin/sh | ||
# | ||
# chkconfig: - 55 45 | ||
# description: The memcached daemon is a network memory cache service. | ||
# processname: memcached | ||
# config: /etc/sysconfig/memcached | ||
# pidfile: /var/run/memcached/memcached.*.pid | ||
|
||
# Source function library. | ||
. /etc/init.d/functions | ||
|
||
PORT=11211 | ||
USER=memcached | ||
MAXCONN=1024 | ||
OPTIONS="" | ||
|
||
if [ -f /etc/sysconfig/memcached ];then | ||
. /etc/sysconfig/memcached | ||
fi | ||
|
||
# Check that networking is up. | ||
. /etc/sysconfig/network | ||
|
||
if [ "$NETWORKING" = "no" ] | ||
then | ||
exit 0 | ||
fi | ||
|
||
RETVAL=0 | ||
prog="/usr/local/memcached/bin/memcached" | ||
|
||
start_instance() { | ||
echo -n $"Starting $prog ($1): " | ||
daemon --pidfile /var/run/memcached/memcached.$1.pid memcached -d -p $PORT -u $USER -m $2 -c $MAXCONN -P /var/run/memcached/memcached.$1.pid $OPTIONS | ||
RETVAL=$? | ||
echo | ||
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/memcached.$1 | ||
PORT=`expr $PORT + 1` | ||
} | ||
|
||
stop_instance() { | ||
echo -n $"Stopping $prog ($1): " | ||
killproc -p /var/run/memcached/memcached.$1.pid /usr/bin/memcached | ||
RETVAL=$? | ||
echo | ||
if [ $RETVAL -eq 0 ] ; then | ||
rm -f /var/lock/subsys/memcached.$1 | ||
rm -f /var/run/memcached.$1.pid | ||
fi | ||
} | ||
|
||
start () { | ||
# insure that /var/run/memcached has proper permissions | ||
mkdir -p /var/run/memcached | ||
if [ "`stat -c %U /var/run/memcached`" != "$USER" ]; then | ||
chown $USER /var/run/memcached | ||
fi | ||
|
||
start_instance default 64; | ||
#start_instance block 16; | ||
#start_instance content 128; | ||
#start_instance filter 128; | ||
#start_instance form 32; | ||
#start_instance menu 16; | ||
#start_instance page 8; | ||
#start_instance update 8; | ||
#start_instance views 8; | ||
} | ||
stop () { | ||
stop_instance default; | ||
#stop_instance block; | ||
#stop_instance content; | ||
#stop_instance filter; | ||
#stop_instance form; | ||
#stop_instance menu; | ||
#stop_instance page; | ||
#stop_instance update; | ||
#stop_instance views; | ||
} | ||
|
||
restart () { | ||
stop | ||
start | ||
} | ||
|
||
|
||
# See how we were called. | ||
case "$1" in | ||
start) | ||
start | ||
;; | ||
stop) | ||
stop | ||
;; | ||
status) | ||
status memcached | ||
;; | ||
restart|reload|force-reload) | ||
restart | ||
;; | ||
*) | ||
echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}" | ||
exit 1 | ||
esac | ||
|
||
exit $? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#! /bin/sh | ||
# | ||
|
||
PORT=11211 | ||
USER=memcached | ||
MAXCONN=1024 | ||
OPTIONS="" | ||
DAEMON=/usr/local/memcached/bin/memcached | ||
|
||
RETVAL=0 | ||
prog="/usr/local/memcached/bin/memcached" | ||
|
||
start_instance() { | ||
echo -n $"Starting $prog ($1): " | ||
start-stop-daemon --start --quiet --pidfile /var/run/memcached/memcached.$1.pid --exec $DAEMON -- -d -p $PORT -u $USER -m $2 -c $MAXCONN -P /var/run/memcached/memcached.$1.pid $OPTIONS | ||
RETVAL=$? | ||
echo | ||
[ $RETVAL -eq 0 ] && touch /var/lock/memcached.$1 | ||
PORT=`expr $PORT + 1` | ||
} | ||
|
||
stop_instance() { | ||
echo -n $"Stopping $prog ($1): " | ||
start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/memcached/memcached.$1.pid --exec $DAEMON | ||
RETVAL=$? | ||
echo | ||
if [ $RETVAL -eq 0 ] ; then | ||
rm -f /var/lock/memcached.$1 | ||
rm -f /var/run/memcached/memcached.$1.pid | ||
fi | ||
} | ||
start () { | ||
# insure that /var/run/memcached has proper permissions | ||
mkdir -p /var/run/memcached | ||
if [ "`stat -c %U /var/run/memcached`" != "$USER" ]; then | ||
chown $USER /var/run/memcached | ||
fi | ||
|
||
start_instance default 64; | ||
#start_instance block 16; | ||
#start_instance content 128; | ||
#start_instance filter 128; | ||
#start_instance form 32; | ||
#start_instance menu 16; | ||
#start_instance page 8; | ||
#start_instance update 8; | ||
#start_instance views 8; | ||
} | ||
stop () { | ||
stop_instance default; | ||
#stop_instance block; | ||
#stop_instance content; | ||
#stop_instance filter; | ||
#stop_instance form; | ||
#stop_instance menu; | ||
#stop_instance page; | ||
#stop_instance update; | ||
#stop_instance views; | ||
} | ||
|
||
restart () { | ||
stop | ||
start | ||
} | ||
|
||
# See how we were called. | ||
case "$1" in | ||
start) | ||
start | ||
;; | ||
stop) | ||
stop | ||
;; | ||
status) | ||
status memcached | ||
;; | ||
restart|reload|force-reload) | ||
restart | ||
;; | ||
*) | ||
echo $"Usage: $0 {start|stop|status|restart|reload|force-reload}" | ||
exit 1 | ||
esac | ||
|
||
exit $? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
#!/bin/sh | ||
# | ||
# nginx - this script starts and stops the nginx daemon | ||
# | ||
# chkconfig: - 85 15 | ||
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \ | ||
# proxy and IMAP/POP3 proxy server | ||
# processname: nginx | ||
# config: /usr/local/nginx/conf/nginx.conf | ||
# pidfile: /var/run/nginx.pid | ||
|
||
# Source function library. | ||
. /etc/rc.d/init.d/functions | ||
|
||
# Source networking configuration. | ||
. /etc/sysconfig/network | ||
|
||
# Check that networking is up. | ||
[ "$NETWORKING" = "no" ] && exit 0 | ||
|
||
nginx="/usr/local/nginx/sbin/nginx" | ||
prog=$(basename $nginx) | ||
|
||
NGINX_CONF_FILE="/usr/local/nginx/conf/nginx.conf" | ||
|
||
[ -f /etc/sysconfig/nginx ] && . /etc/sysconfig/nginx | ||
|
||
lockfile=/var/lock/subsys/nginx | ||
|
||
make_dirs() { | ||
# make required directories | ||
user=`$nginx -V 2>&1 | grep "configure arguments:" | sed 's/[^*]*--user=\([^ ]*\).*/\1/g' -` | ||
if [ -z "`grep $user /etc/passwd`" ]; then | ||
useradd -M -s /bin/nologin $user | ||
fi | ||
options=`$nginx -V 2>&1 | grep 'configure arguments:'` | ||
for opt in $options; do | ||
if [ `echo $opt | grep '.*-temp-path'` ]; then | ||
value=`echo $opt | cut -d "=" -f 2` | ||
if [ ! -d "$value" ]; then | ||
# echo "creating" $value | ||
mkdir -p $value && chown -R $user $value | ||
fi | ||
fi | ||
done | ||
} | ||
|
||
start() { | ||
[ -x $nginx ] || exit 5 | ||
[ -f $NGINX_CONF_FILE ] || exit 6 | ||
make_dirs | ||
echo -n $"Starting $prog: " | ||
daemon $nginx -c $NGINX_CONF_FILE | ||
retval=$? | ||
echo | ||
[ $retval -eq 0 ] && touch $lockfile | ||
return $retval | ||
} | ||
|
||
stop() { | ||
echo -n $"Stopping $prog: " | ||
killproc $prog -QUIT | ||
retval=$? | ||
echo | ||
[ $retval -eq 0 ] && rm -f $lockfile | ||
return $retval | ||
} | ||
|
||
restart() { | ||
configtest || return $? | ||
stop | ||
sleep 3 | ||
start | ||
} | ||
|
||
reload() { | ||
configtest || return $? | ||
echo -n $"Reloading $prog: " | ||
killproc $nginx -HUP | ||
RETVAL=$? | ||
echo | ||
} | ||
|
||
force_reload() { | ||
restart | ||
} | ||
|
||
configtest() { | ||
$nginx -t -c $NGINX_CONF_FILE | ||
} | ||
|
||
rh_status() { | ||
status $prog | ||
} | ||
|
||
rh_status_q() { | ||
rh_status >/dev/null 2>&1 | ||
} | ||
|
||
case "$1" in | ||
start) | ||
rh_status_q && exit 0 | ||
$1 | ||
;; | ||
stop) | ||
rh_status_q || exit 0 | ||
$1 | ||
;; | ||
restart|configtest) | ||
$1 | ||
;; | ||
reload) | ||
rh_status_q || exit 7 | ||
$1 | ||
;; | ||
force-reload) | ||
force_reload | ||
;; | ||
status) | ||
rh_status | ||
;; | ||
condrestart|try-restart) | ||
rh_status_q || exit 0 | ||
;; | ||
*) | ||
echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload|configtest}" | ||
exit 2 | ||
esac |
Oops, something went wrong.