首页 > 代码库 > beanstalkd自动安装脚本
beanstalkd自动安装脚本
#!/bin/bash PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin export PATH # Check if user is root if [ $(id -u) != "0" ]; then echo "Error: You must be root to run this script, please use root to install lnmp" exit 1 fi clear printf "=======================================================================\n" printf "Install Beanstalkd for LNMP V1.0 , Written by Wangys \n" printf "=======================================================================\n" printf "LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux \n" printf "This script is a tool to install beanstalkd-1.10 for lnmp \n" printf "\n" printf "For more information please visit http://www.lnmp.org \n" printf "=======================================================================\n" cur_dir=$(pwd) get_char() { SAVEDSTTY=`stty -g` stty -echo stty cbreak dd if=/dev/tty bs=1 count=1 2> /dev/null stty -raw stty echo stty $SAVEDSTTY } echo "" echo "Press any key to start install beanstalkd..." char=`get_char` printf "=========================== install beanstalkd ======================\n" cd $cur_dir echo "Install beanstalkd..." # create download and build directory wget -c https://github.com/kr/beanstalkd/archive/v1.10.tar.gz -O beanstalkd-1.10.tar.gz tar zxvf beanstalkd-1.10.tar.gz cd beanstalkd-1.10/ #/usr/local/bin/beanstalkd make &&make install # link binary - original debian package init.d script uses hard coded /usr/bin/beanstalkd ln -s /usr/local/bin/beanstalkd /usr/bin/beanstalkd cd ../ cd $cur_dir #download init.d script cp beanstalkd.init.d /etc/init.d/beanstalkd chown 0:0 /etc/init.d/beanstalkd chmod u+x /etc/init.d/beanstalkd #create journal path before usage, otherwise beanstalkd will not start at all mkdir -p /var/lib/beanstalkd #create log path mkdir -p /var/log/beanstalkd # start beanstalkd /etc/init.d/beanstalkd start #sudo /usr/local/bin/beanstalkd -l 0.0.0.0 -p 11300 -b /var/lib/beanstalkd -V # check beanstalkd status /etc/init.d/beanstalkd status if [ ! -d /var/lock/subsys ]; then mkdir -p /var/lock/subsys fi if [ -s /etc/debian_version ]; then update-rc.d -f beanstalkd defaults elif [ -s /etc/redhat-release ]; then chkconfig --level 345 beanstalkd on fi printf "===================== install Beanstalkd completed =====================\n" printf "Install Beanstalkd completed,enjoy it!\n" printf "=======================================================================\n" printf "Install Beanstalkd for LNMP V1.0 , Written by wangys \n" printf "=======================================================================\n" printf "LNMP is a tool to auto-compile & install Nginx+MySQL+PHP on Linux \n" printf "This script is a tool to install Beanstalkd for lnmp \n" printf "\n" printf "For more information please visit http://www.lnmp.org \n" printf "=======================================================================\n"
#! /bin/sh # chkconfig: 2345 55 25 # Description: Startup script for nginx webserver on Debian. Place in /etc/init.d and # run 'update-rc.d -f nginx defaults', or use the appropriate command on your # distro. For CentOS/Redhat run: 'chkconfig --add beanstalkd' ### BEGIN INIT INFO # Provides: beanstalkd # Required-Start: $all # Required-Stop: $all # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: starts the beanstalkd # Description: starts beanstalkd using start-stop-daemon ### END INIT INFO # Author: licess # website: http://lnmp.org PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin NAME=beanstalkd BIN=/usr/bin/$NAME CONFIGFILE= PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME ## Defaults for the beanstalkd init script, /etc/init.d/beanstalkd on ## Debian systems. Append "-b /var/lib/beanstalkd" for persistent ## storage. BEANSTALKD_LISTEN_ADDR=0.0.0.0 BEANSTALKD_LISTEN_PORT=11300 # create the journal path before use !!! BEANSTALKD_JOURNAL_PATH="/var/lib/beanstalkd" DAEMON_OPTS="-l $BEANSTALKD_LISTEN_ADDR -p $BEANSTALKD_LISTEN_PORT -b $BEANSTALKD_JOURNAL_PATH -V" case "$1" in start) echo -n "Starting $NAME... " if netstat -tnpl | grep -q beanstalkd;then echo "$NAME (pid `pidof $NAME`) already running." exit 1 fi $BIN $DAEMON_OPTS >/dev/null 2>&1 & if [ "$?" != 0 ] ; then echo " failed" exit 1 else echo " done" fi ;; stop) echo -n "Terminating $NAME... " if ! netstat -tnpl | grep -q beanstalkd; then echo "$NAME is not running." exit 1 fi kill `pidof $NAME` if [ "$?" != 0 ] ; then echo " failed" exit 1 else echo " done" fi ;; status) if netstat -tnpl | grep -q beanstalkd; then PID=`pidof beanstalkd` echo "$NAME (pid $PID) is running..." else echo "$NAME is stopped" exit 0 fi ;; restart) $SCRIPTNAME stop sleep 1 $SCRIPTNAME start ;; *) echo "Usage: $SCRIPTNAME {start|stop|status}" exit 1 ;; esac
beanstalkd自动安装脚本
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。