配置sh文件到chkconfg
#!/bin/bash
#chkconfig:2345 20 90
#description:zookeeper
#processname:zookeeper
case $1 in
start) su root /opt/zkhome/zookeeper-3.3.6/bin/zkServer.sh start;;
stop) su root /opt/zkhome/zookeeper-3.3.6/bin/zkServer.sh stop;;
status) su root /opt/zkhome/zookeeper-3.3.6/bin/zkServer.sh status;;
restart) su root /opt/zkhome/zookeeper-3.3.6/bin/zkServer.sh restart;;
*) echo "require start|stop|status|restart" ;;
esac
chkconfig --add zookeeper
chkconfig zookeeper on
--------------------------------------
vi /etc/init.d/redsentinel
#!/bin/bash
#chkconfig:2345 95 70
# redis-sentinel /etc/redis/sentinel.conf --sentinel &>/var/log/redis_28379_sentinal.log &
# Starts redis sentinel using start-stop-daemon
# Jimmy,http://www.jimmy2k.top/
# 2016-02-17
NAME=redis-sentinel
#BIN=/usr/local/bin/redis-server # --1--
BIN=/usr/local/bin/redis-sentinel
CONF=/etc/redis/sentinel.conf
SENTINEL_PID=/tmp/redis-sentinel.pid
CMD=$1
start() {
echo "Starting $NAME ..."
# exec 2>&1 $BIN $CONF --sentinel | logger -t sentinel & # --2--
#exec 2>&1 $BIN $CONF --sentinel &>/dev/null &
exec 2>&1 $BIN $CONF --sentinel &>/var/log/redis_28379_sentinal.log &
echo $! > "${SENTINEL_PID}";
}
stop() {
PID=`cat $SENTINEL_PID`
echo "Stopping $NAME ($PID) ..."
kill $PID
}
restart() {
echo "Restarting $NAME ..."
stop
start
}
status() {
echo "Usage $0 {start|stop|restart}"
}
case "$CMD" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
status)
status
;;
*)
echo "Usage $0 {start|stop|restart}"
esac
- 本文标签: 暂无相关标签
- 本文链接: https://www.jimmy2k.top/article/154
- 版权声明: 本文由JimmyZ的个人博客原创发布,转载请遵循《署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)》许可协议授权