In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to use the rabbitmq startup script under Linux, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Record a rabbitmq startup script and modify some of the parameters.
Vi / etc/init.d/rabbitmq-server # script content, as shown in the figure, you need to modify the parameter chmod + x / etc/init.d/rabbitmq-serverchkconfig-add rabbitmq-serverchkconfig rabbitmq-server on
As shown below:
RabbitMQ startup script #! / bin/sh## rabbitmq-server RabbitMQ broker## chkconfig:-800 description: Enable AMQP service provided by RabbitMQ#### BEGIN INIT INFO# Provides: rabbitmq-server# Required-Start: $remote_fs $network# Required-Stop: $remote_fs $network# Description: RabbitMQ broker# Short-Description: Enable AMQP service provided by RabbitMQ broker### END INIT INFO# Source function library.. / etc/init.d/functionsPATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/erlang/binNAME=rabbitmq-serverDAEMON=/usr/sbin/$ {NAME} CONTROL=/usr/sbin/rabbitmqctlDESC=rabbitmq-serverUSER=rabbitmqROTATE_SUFFIX=INIT_LOG_DIR=/usr/local/rabbitmq/var/rabbitmqPID_FILE=/var/run/rabbitmq/pidSTART_PROG= "daemon" LOCK_FILE=/var/lock/subsys/$NAMEtest-x $DAEMON | | exit 0test-x $CONTROL | | exit 0RETVAL=0set-e [- f / etc/default/$ {NAME}] & &. / etc/default/$ {NAME} [- f / etc/sysconfig/$ {NAME}] &. / etc/sysconfig/$ {NAME} ensure_pid_dir () {PID_DIR= `dirname ${PID_FILE} `if [!-d ${PID_DIR}] Then mkdir-p ${PID_DIR} chown-R ${USER}: ${USER} ${PID_DIR} chmod 755 ${PID_DIR} fi} remove_pid () {rm-f ${PID_FILE} rmdir `dirname ${PID_FILE} `|:} start_rabbitmq () {status_rabbitmq quiet if [$RETVAL = 0] Then echo RabbitMQ is currently running else RETVAL=0 # RABBIT_NOFILES_LIMIT from / etc/sysconfig/rabbitmq-server is not handled # automatically if ["$RABBITMQ_NOFILES_LIMIT"] Then ulimit-n $RABBITMQ_NOFILES_LIMIT fi ensure_pid_dir set + e RABBITMQ_PID_FILE=$PID_FILE $START_PROG $DAEMON\ > "${INIT_LOG_DIR} / startup_log"\ 2 > "${INIT_LOG_DIR} / startup_err"\ 0$ CONTROL wait $PID_FILE > / dev/null 2 > & 1 RETVAL=$? Set-e case "$RETVAL" in 0) echo SUCCESS if [- n "$LOCK_FILE"]; then touch $LOCK_FILE fi *) remove_pid echo FAILED-check ${INIT_LOG_DIR} / startup_\ {log, _ err\} RETVAL=1;; esac fi} stop_rabbitmq () {status_rabbitmq quiet if [$RETVAL= 0] Then set + e $CONTROL stop ${PID_FILE} > ${INIT_LOG_DIR} / shutdown_log 2 > ${INIT_LOG_DIR} / shutdown_err RETVAL=$? Set-e if [$RETVAL = 0]; then remove_pid if [- n "$LOCK_FILE"] Then rm-f $LOCK_FILE fi else echo FAILED-check ${INIT_LOG_DIR} / shutdown_log, _ err fi else echo RabbitMQ is not running RETVAL=0 fi} status_rabbitmq () {set + e if ["$1"! = "quiet"] Then $CONTROL status 2 > & 1 else $CONTROL status > / dev/null 2 > & 1 fi if [$?! = 0]; then RETVAL=3 fi set-e} rotate_logs_rabbitmq () {set + e $CONTROL rotate_logs ${ROTATE_SUFFIX} if [$?! = 0]; then RETVAL=1 fi set-e} restart_running_rabbitmq () {status_rabbitmq quiet if [$RETVAL= 0] Then restart_rabbitmq else echo RabbitMQ is not runnning RETVAL=0 fi} restart_rabbitmq () {stop_rabbitmq start_rabbitmq} case "$1" in start) echo-n "Starting $DESC:" start_rabbitmq echo "$NAME."; stop) echo-n "Stopping $DESC:" stop_rabbitmq echo "$NAME."; status) status_rabbitmq Rotate-logs) echo-n "Rotating log files for $DESC:" rotate_logs_rabbitmq;; force-reload | reload | restart) echo-n "Restarting $DESC:" restart_rabbitmq echo "$NAME.";; try-restart) echo-n "Restarting $DESC:" restart_running_rabbitmq echo "$NAME." *) echo "Usage: $0 {start | stop | status | rotate-logs | restart | condrestart | try-restart | reload | force-reload}" > & 2 RETVAL=1;; esacexit $RETVAL is all the contents of the article "how to use rabbitmq startup script under Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.