вторник, июня 19, 2012

Memcacheq init.d script

source: memcacheq by Alexander Titov (qik) 
I removed few parameters from line 43
  • vim /etc/init.d/memcacheq
 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
#! /bin/sh
#
# chkconfig: - 55 45
# description:  The memcacheq daemon is a network memory cache service.
# processname: memcacheq
# config: /etc/sysconfig/memcacheq
# pidfile: /var/run/memcached/memcacheq.pid

# Standard LSB functions
#. /lib/lsb/init-functions

# Source function library.
. /etc/init.d/functions

if [ -f /etc/sysconfig/memcacheq ];then
        . /etc/sysconfig/memcacheq
fi

# Check that networking is up.
. /etc/sysconfig/network

if [ "$NETWORKING" = "no" ]
then
        exit 0
fi

RETVAL=0
prog="memcacheq"

start () {
        echo -n $"Starting $prog: "

    if [ ! -e /var/run/memcacheq ]; then
        mkdir /var/run/memcacheq
    fi

        # insure that /var/run/memcacheq has proper permissions
    if [ "`stat -c %U /var/run/memcacheq`" != "$USER" ]; then
        chown $USER /var/run/memcacheq
    fi

        daemon --pidfile /var/run/memcacheq/memcacheq.pid /usr/local/bin/memcacheq -d -N -p $PORT -u $USER  -H "$DATADIR" -B $MAXMESSAGE -L $LOGBUF -P /var/run/memcacheq/memcacheq.pid $OPTIONS
#        daemon --pidfile /var/run/memcacheq/memcacheq.pid /usr/local/bin/memcacheq -d -N -p $PORT -u $USER  -m $CACHESIZE -c $MAXCONN -H "$DATADIR" -B $MAXMESSAGE -A $PAGESIZE -L $LOGBUF -P /var/run/memcacheq/memcacheq.pid $OPTIONS
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ] && touch /var/lock/subsys/memcacheq
}
stop () {
        echo -n $"Stopping $prog: "
        killproc -p /var/run/memcacheq/memcacheq.pid /usr/local/bin/memcacheq
        RETVAL=$?
        echo
        if [ $RETVAL -eq 0 ] ; then
            rm -f /var/lock/subsys/memcacheq
            rm -f /var/run/memcacheq.pid
        fi
}

restart () {
        stop
        start
}


# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        status memcacheq
        ;;
  restart|reload|force-reload)
        restart
        ;;
  condrestart)
        [ -f /var/lock/subsys/memcacheq ] && restart || :
        ;;
  *)
        echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"
        exit 1
esac

exit $?
  • vim /etc/sysconfig/memcacheq
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Configuration file for the memcacheq service.

DATADIR=/data1/memcacheq

LOGBUF=1024

MAXMESSAGE=1024

OPTIONS='> /data1/mq_error.log'

USER=root

PORT=22201
  • service memcacheq start
  • chkconfig memcacheq on

Комментариев нет: