#!/bin/bash
#description:activemq
ACTIVEMQ_PATH=/usr/local/activemq
export JAVA_HOME=/usr/java/jdk1.8.0_241-amd64
case $1 in
start)
echo "Starting activemq..."
$ACTIVEMQ_PATH/bin/activemq.sh start;;
stop)
echo "Starting activemq..."
$ACTIVEMQ_PATH/bin/activemq.sh stop;;
status)
echo "Starting activemq..."
$ACTIVEMQ_PATH/bin/activemq.sh status;;
*)
echo "Usage: activemq {start|stop|status}" ;;
esac
#!/bin/bash
#description:tomcat
CATALANA_HOME=/usr/local/tomcat
export JAVA_HOME=/usr/java/jdk1.8.0_241-amd64
case $1 in
start)
echo "Starting Tomcat..."
$CATALANA_HOME/bin/startup.sh
;;
stop)
echo "Stopping Tomcat..."
$CATALANA_HOME/bin/shutdown.sh
;;
restart)
echo "Stopping Tomcat..."
$CATALANA_HOME/bin/shutdown.sh
sleep 2
echo
echo "Starting Tomcat..."
$CATALANA_HOME/bin/startup.sh
;;
*)
echo "Usage: tomcat {start|stop|restart}"
;; esac
#!/bin/bash
#description:solr
SOLR_PATH=/usr/local/solr-8.4.1
export JAVA_HOME=/usr/java/jdk1.8.0_241-amd64
case $1 in
start)
$SOLR_PATH/bin/solr start -force;;
stop)
$SOLR_PATH/bin/solr stop -all;;
*)
echo "Usage: tomcat {start|stop}" ;;
esac
#!/bin/bash
#description:zookeeper
ZK_PATH=/usr/local/zookeeper
export JAVA_HOME=/usr/java/jdk1.8.0_241-amd64
case $1 in
start) sh $ZK_PATH/bin/zkServer.sh start;;
stop) sh $ZK_PATH/bin/zkServer.sh stop;;
status) sh $ZK_PATH/bin/zkServer.sh status;;
restart) sh $ZK_PATH/bin/zkServer.sh restart;;
*) echo "require start|stop|status|restart" ;;
esac
################################################################################################
服务脚本必须存放在/etc/ini.d/目录下
列出服务:chkconfig --list
添加权限:chmod +x /etc/init.d/zookeeper
加入服务:chkconfig --add zookeeper
删除服务:chkconfig --del zookeeper
开机自启:chkconfig zookeeper on
因篇幅问题不能全部显示,请点此查看更多更全内容