mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-18 22:06:04 +01:00
41 lines
589 B
Text
41 lines
589 B
Text
|
#!/bin/sh
|
||
|
# Start/stop/restart Apache Zookeeper daemon
|
||
|
|
||
|
SERVER_CONFIG=(server.properties)
|
||
|
|
||
|
USER=kafka
|
||
|
kafka_start(){
|
||
|
for conf in ${SERVER_CONFIG[@]}; do
|
||
|
sudo -u ${USER} sh -c "/usr/bin/kafka-server-start.sh -daemon /etc/kafka/${conf}"
|
||
|
done
|
||
|
}
|
||
|
|
||
|
kafka_stop() {
|
||
|
sudo -u ${USER} sh -c "/usr/bin/kafka-server-stop.sh"
|
||
|
}
|
||
|
|
||
|
kafka_restart() {
|
||
|
kafka_start
|
||
|
sleep 1
|
||
|
kafka_stop
|
||
|
}
|
||
|
|
||
|
print_usage() {
|
||
|
echo "usage $0 start|stop|restart"
|
||
|
}
|
||
|
|
||
|
case "$1" in
|
||
|
'start')
|
||
|
kafka_start
|
||
|
;;
|
||
|
'stop')
|
||
|
kafka_stop
|
||
|
;;
|
||
|
'restart')
|
||
|
kafka_restart
|
||
|
;;
|
||
|
*)
|
||
|
print_usage
|
||
|
;;
|
||
|
esac
|