Category: MySQLProxy

MySQL Proxy init

This init script was tested with MySQL Proxy and RedHat and Fedora 8

[edit] /etc/init.d/mysql-proxy

Only change PROXY_PATH=/opt/mysql-proxy/sbin var to directory where mysql-proxy bin is located.

#!/bin/sh
#
# mysql-proxy This script starts and stops the mysql-proxy daemon
#
# chkconfig: - 78 30
# processname: mysql-proxy
# description: mysql-proxy is a proxy daemon to mysql

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

PROXY_PATH=/opt/mysql-proxy/sbin

prog="mysql-proxy"

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

# Set default mysql-proxy configuration.
PROXY_OPTIONS="--daemon"
PROXY_PID=/var/run/mysql-proxy.pid

# Source mysql-proxy configuration.
if [ -f /etc/sysconfig/mysql-proxy ] ; then
        . /etc/sysconfig/mysql-proxy
fi

PATH=$PATH:/usr/bin:/usr/local/bin:$PROXY_PATH

# By default it's all good
RETVAL=0

# See how we were called.
case "$1" in
  start)
        # Start daemon.
        echo -n $"Starting $prog: "
        daemon $NICELEVEL $PROXY_PATH/mysql-proxy $PROXY_OPTIONS --pid-file $PROXY_PID
        RETVAL=$?
        echo
        if [ $RETVAL = 0 ]; then
                touch /var/lock/subsys/mysql-proxy
        fi
        ;;
  stop)
        # Stop daemons.
        echo -n $"Stopping $prog: "
        killproc $prog
        RETVAL=$?
        echo
        if [ $RETVAL = 0 ]; then
                rm -f /var/lock/subsys/mysql-proxy
                rm -f $PROXY_PID
        fi
        ;;
  restart)
        $0 stop
        sleep 3
        $0 start
        ;;
  condrestart)
       [ -e /var/lock/subsys/mysql-proxy ] && $0 restart
       ;;
  status)
        status mysql-proxy
        RETVAL=$?
        ;;
  *)
        echo "Usage: $0 {start|stop|restart|status|condrestart}"
        RETVAL=1
        ;;
esac

exit $RETVAL

[edit] /etc/sysconfig/mysql-proxy

Here you set mysql-proxy parameters

# Options to mysql-proxy 
# do not remove --daemon
PROXY_OPTIONS="--daemon"

Retrieved from "http://forge.mysql.com/wiki/MySQL_Proxy_init"

This page has been accessed 17,882 times. This page was last modified 22:06, 24 January 2011.

Find

Browse
MySQLForge
Main Page
Current events
Recent changes
Random page
Help
Edit
Edit this page
Editing help
This page
Discuss this page
Post a comment
Printable version
Context
Page history
What links here
Related changes
My pages
Special pages
New pages
File list
Statistics
Bug reports
More...