Browse Source

[Bug] [Dev] Fix start/stop/status/init script error (#9514)

* change /bin/sh to /bin/bash

* change /bin/sh to /bin/bash

* remove declear -A to adapt mac
3.0.0/version-upgrade
xiangzihao 3 years ago committed by GitHub
parent
commit
ec939fcc68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      dolphinscheduler-tools/src/main/assembly/dolphinscheduler-tools.xml
  2. 8
      dolphinscheduler-tools/src/main/bin/create-schema.sh
  3. 8
      dolphinscheduler-tools/src/main/bin/upgrade-schema.sh
  4. 4
      script/dolphinscheduler-daemon.sh
  5. 10
      script/install.sh
  6. 4
      script/scp-hosts.sh
  7. 14
      script/start-all.sh
  8. 12
      script/status-all.sh
  9. 12
      script/stop-all.sh

2
dolphinscheduler-tools/src/main/assembly/dolphinscheduler-tools.xml

@ -52,7 +52,7 @@
<includes> <includes>
<include>sql/**/*</include> <include>sql/**/*</include>
</includes> </includes>
<outputDirectory>conf</outputDirectory> <outputDirectory>sql</outputDirectory>
</fileSet> </fileSet>
<fileSet> <fileSet>
<directory>${basedir}/../dolphinscheduler-common/src/main/resources</directory> <directory>${basedir}/../dolphinscheduler-common/src/main/resources</directory>

8
dolphinscheduler-tools/src/main/bin/create-schema.sh

@ -17,10 +17,12 @@
# #
BIN_DIR=$(dirname $0) BIN_DIR=$(dirname $0)
DOLPHINSCHEDULER_HOME=${DOLPHINSCHEDULER_HOME:-$(cd $BIN_DIR/..; pwd)} DOLPHINSCHEDULER_HOME=${DOLPHINSCHEDULER_HOME:-$(cd $BIN_DIR/../..; pwd)}
source "$BIN_DIR/dolphinscheduler_env.sh" source "$DOLPHINSCHEDULER_HOME/bin/env/dolphinscheduler_env.sh"
JAVA_OPTS=${JAVA_OPTS:-"-server -Duser.timezone=${SPRING_JACKSON_TIME_ZONE} -Xms1g -Xmx1g -Xmn512m -XX:+PrintGCDetails -Xloggc:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof"}
java $JAVA_OPTS \ java $JAVA_OPTS \
-cp "$DOLPHINSCHEDULER_HOME/conf":"$DOLPHINSCHEDULER_HOME/libs/*" \ -cp "$DOLPHINSCHEDULER_HOME/conf":"$DOLPHINSCHEDULER_HOME/tools/libs/*":"$DOLPHINSCHEDULER_HOME/tools/sql" \
org.apache.dolphinscheduler.tools.datasource.CreateDolphinScheduler org.apache.dolphinscheduler.tools.datasource.CreateDolphinScheduler

8
dolphinscheduler-tools/src/main/bin/upgrade-schema.sh

@ -17,10 +17,12 @@
# #
BIN_DIR=$(dirname $0) BIN_DIR=$(dirname $0)
DOLPHINSCHEDULER_HOME=${DOLPHINSCHEDULER_HOME:-$(cd $BIN_DIR/..; pwd)} DOLPHINSCHEDULER_HOME=${DOLPHINSCHEDULER_HOME:-$(cd $BIN_DIR/../..; pwd)}
source "$BIN_DIR/dolphinscheduler_env.sh" source "$DOLPHINSCHEDULER_HOME/bin/env/dolphinscheduler_env.sh"
JAVA_OPTS=${JAVA_OPTS:-"-server -Duser.timezone=${SPRING_JACKSON_TIME_ZONE} -Xms1g -Xmx1g -Xmn512m -XX:+PrintGCDetails -Xloggc:gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=dump.hprof"}
java $JAVA_OPTS \ java $JAVA_OPTS \
-cp "$DOLPHINSCHEDULER_HOME/conf":"$DOLPHINSCHEDULER_HOME/libs/*" \ -cp "$DOLPHINSCHEDULER_HOME/conf":"$DOLPHINSCHEDULER_HOME/tools/libs/*":"$DOLPHINSCHEDULER_HOME/tools/sql" \
org.apache.dolphinscheduler.tools.datasource.UpgradeDolphinScheduler org.apache.dolphinscheduler.tools.datasource.UpgradeDolphinScheduler

4
script/dolphinscheduler-daemon.sh

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
# Licensed to the Apache Software Foundation (ASF) under one or more # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with # contributor license agreements. See the NOTICE file distributed with
@ -69,7 +69,7 @@ fi
case $startStop in case $startStop in
(start) (start)
echo starting $command, logging to $DOLPHINSCHEDULER_LOG_DIR echo starting $command, logging to $DOLPHINSCHEDULER_LOG_DIR
nohup /bin/sh "$DOLPHINSCHEDULER_HOME/$command/bin/start.sh" > $log 2>&1 & nohup /bin/bash "$DOLPHINSCHEDULER_HOME/$command/bin/start.sh" > $log 2>&1 &
echo $! > $pid echo $! > $pid
;; ;;

10
script/install.sh

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
# Licensed to the Apache Software Foundation (ASF) under one or more # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with # contributor license agreements. See the NOTICE file distributed with
@ -30,7 +30,7 @@ if [ ! -d $installPath ];then
fi fi
echo "2.scp resources" echo "2.scp resources"
sh ${workDir}/scp-hosts.sh bash ${workDir}/scp-hosts.sh
if [ $? -eq 0 ];then if [ $? -eq 0 ];then
echo 'scp copy completed' echo 'scp copy completed'
else else
@ -39,10 +39,10 @@ else
fi fi
echo "3.stop server" echo "3.stop server"
sh ${workDir}/stop-all.sh bash ${workDir}/stop-all.sh
echo "4.delete zk node" echo "4.delete zk node"
sh ${workDir}/remove-zk-node.sh $zkRoot bash ${workDir}/remove-zk-node.sh $zkRoot
echo "5.startup" echo "5.startup"
sh ${workDir}/start-all.sh bash ${workDir}/start-all.sh

4
script/scp-hosts.sh

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
# Licensed to the Apache Software Foundation (ASF) under one or more # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with # contributor license agreements. See the NOTICE file distributed with
@ -27,8 +27,6 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
txt="''" txt="''"
fi fi
declare -A workersGroupMap=()
workersGroup=(${workers//,/ }) workersGroup=(${workers//,/ })
for workerGroup in ${workersGroup[@]} for workerGroup in ${workersGroup[@]}
do do

14
script/start-all.sh

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
# Licensed to the Apache Software Foundation (ASF) under one or more # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with # contributor license agreements. See the NOTICE file distributed with
@ -21,8 +21,6 @@ workDir=`cd ${workDir};pwd`
source ${workDir}/env/install_env.sh source ${workDir}/env/install_env.sh
declare -A workersGroupMap=()
workersGroup=(${workers//,/ }) workersGroup=(${workers//,/ })
for workerGroup in ${workersGroup[@]} for workerGroup in ${workersGroup[@]}
do do
@ -36,7 +34,7 @@ mastersHost=(${masters//,/ })
for master in ${mastersHost[@]} for master in ${mastersHost[@]}
do do
echo "$master master server is starting" echo "$master master server is starting"
ssh -p $sshPort $master "cd $installPath/; sh bin/dolphinscheduler-daemon.sh start master-server;" ssh -p $sshPort $master "cd $installPath/; bash bin/dolphinscheduler-daemon.sh start master-server;"
done done
@ -44,18 +42,18 @@ for worker in ${!workersGroupMap[*]}
do do
echo "$worker worker server is starting" echo "$worker worker server is starting"
ssh -p $sshPort $worker "cd $installPath/; sh bin/dolphinscheduler-daemon.sh start worker-server;" ssh -p $sshPort $worker "cd $installPath/; bash bin/dolphinscheduler-daemon.sh start worker-server;"
done done
ssh -p $sshPort $alertServer "cd $installPath/; sh bin/dolphinscheduler-daemon.sh start alert-server;" ssh -p $sshPort $alertServer "cd $installPath/; bash bin/dolphinscheduler-daemon.sh start alert-server;"
apiServersHost=(${apiServers//,/ }) apiServersHost=(${apiServers//,/ })
for apiServer in ${apiServersHost[@]} for apiServer in ${apiServersHost[@]}
do do
echo "$apiServer api server is starting" echo "$apiServer api server is starting"
ssh -p $sshPort $apiServer "cd $installPath/; sh bin/dolphinscheduler-daemon.sh start api-server;" ssh -p $sshPort $apiServer "cd $installPath/; bash bin/dolphinscheduler-daemon.sh start api-server;"
done done
# query server status # query server status
echo "query server status" echo "query server status"
cd $installPath/; sh bin/status-all.sh cd $installPath/; bash bin/status-all.sh

12
script/status-all.sh

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
# Licensed to the Apache Software Foundation (ASF) under one or more # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with # contributor license agreements. See the NOTICE file distributed with
@ -37,8 +37,6 @@ firstColumn="node server state"
echo $firstColumn echo $firstColumn
echo -e '\n' echo -e '\n'
declare -A workersGroupMap=()
workersGroup=(${workers//,/ }) workersGroup=(${workers//,/ })
for workerGroup in ${workersGroup[@]} for workerGroup in ${workersGroup[@]}
do do
@ -52,25 +50,25 @@ StateRunning="Running"
mastersHost=(${masters//,/ }) mastersHost=(${masters//,/ })
for master in ${mastersHost[@]} for master in ${mastersHost[@]}
do do
masterState=`ssh -p $sshPort $master "cd $installPath/; sh bin/dolphinscheduler-daemon.sh status master-server;"` masterState=`ssh -p $sshPort $master "cd $installPath/; bash bin/dolphinscheduler-daemon.sh status master-server;"`
echo "$master $masterState" echo "$master $masterState"
done done
# 2.worker server check state # 2.worker server check state
for worker in ${!workersGroupMap[*]} for worker in ${!workersGroupMap[*]}
do do
workerState=`ssh -p $sshPort $worker "cd $installPath/; sh bin/dolphinscheduler-daemon.sh status worker-server;"` workerState=`ssh -p $sshPort $worker "cd $installPath/; bash bin/dolphinscheduler-daemon.sh status worker-server;"`
echo "$worker $workerState" echo "$worker $workerState"
done done
# 3.alter server check state # 3.alter server check state
alertState=`ssh -p $sshPort $alertServer "cd $installPath/; sh bin/dolphinscheduler-daemon.sh status alert-server;"` alertState=`ssh -p $sshPort $alertServer "cd $installPath/; bash bin/dolphinscheduler-daemon.sh status alert-server;"`
echo "$alertServer $alertState" echo "$alertServer $alertState"
# 4.api server check state # 4.api server check state
apiServersHost=(${apiServers//,/ }) apiServersHost=(${apiServers//,/ })
for apiServer in ${apiServersHost[@]} for apiServer in ${apiServersHost[@]}
do do
apiState=`ssh -p $sshPort $apiServer "cd $installPath/; sh bin/dolphinscheduler-daemon.sh status api-server;"` apiState=`ssh -p $sshPort $apiServer "cd $installPath/; bash bin/dolphinscheduler-daemon.sh status api-server;"`
echo "$apiServer $apiState" echo "$apiServer $apiState"
done done

12
script/stop-all.sh

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
# #
# Licensed to the Apache Software Foundation (ASF) under one or more # Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with # contributor license agreements. See the NOTICE file distributed with
@ -21,8 +21,6 @@ workDir=`cd ${workDir};pwd`
source ${workDir}/env/install_env.sh source ${workDir}/env/install_env.sh
declare -A workersGroupMap=()
workersGroup=(${workers//,/ }) workersGroup=(${workers//,/ })
for workerGroup in ${workersGroup[@]} for workerGroup in ${workersGroup[@]}
do do
@ -36,21 +34,21 @@ mastersHost=(${masters//,/ })
for master in ${mastersHost[@]} for master in ${mastersHost[@]}
do do
echo "$master master server is stopping" echo "$master master server is stopping"
ssh -p $sshPort $master "cd $installPath/; sh bin/dolphinscheduler-daemon.sh stop master-server;" ssh -p $sshPort $master "cd $installPath/; bash bin/dolphinscheduler-daemon.sh stop master-server;"
done done
for worker in ${!workersGroupMap[*]} for worker in ${!workersGroupMap[*]}
do do
echo "$worker worker server is stopping" echo "$worker worker server is stopping"
ssh -p $sshPort $worker "cd $installPath/; sh bin/dolphinscheduler-daemon.sh stop worker-server;" ssh -p $sshPort $worker "cd $installPath/; bash bin/dolphinscheduler-daemon.sh stop worker-server;"
done done
ssh -p $sshPort $alertServer "cd $installPath/; sh bin/dolphinscheduler-daemon.sh stop alert-server;" ssh -p $sshPort $alertServer "cd $installPath/; bash bin/dolphinscheduler-daemon.sh stop alert-server;"
apiServersHost=(${apiServers//,/ }) apiServersHost=(${apiServers//,/ })
for apiServer in ${apiServersHost[@]} for apiServer in ${apiServersHost[@]}
do do
echo "$apiServer api server is stopping" echo "$apiServer api server is stopping"
ssh -p $sshPort $apiServer "cd $installPath/; sh bin/dolphinscheduler-daemon.sh stop api-server;" ssh -p $sshPort $apiServer "cd $installPath/; bash bin/dolphinscheduler-daemon.sh stop api-server;"
done done

Loading…
Cancel
Save