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>
<include>sql/**/*</include>
</includes>
<outputDirectory>conf</outputDirectory>
<outputDirectory>sql</outputDirectory>
</fileSet>
<fileSet>
<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)
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 \
-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

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

@ -17,10 +17,12 @@
#
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 \
-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

4
script/dolphinscheduler-daemon.sh

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@ -69,7 +69,7 @@ fi
case $startStop in
(start)
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
;;

10
script/install.sh

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@ -30,7 +30,7 @@ if [ ! -d $installPath ];then
fi
echo "2.scp resources"
sh ${workDir}/scp-hosts.sh
bash ${workDir}/scp-hosts.sh
if [ $? -eq 0 ];then
echo 'scp copy completed'
else
@ -39,10 +39,10 @@ else
fi
echo "3.stop server"
sh ${workDir}/stop-all.sh
bash ${workDir}/stop-all.sh
echo "4.delete zk node"
sh ${workDir}/remove-zk-node.sh $zkRoot
bash ${workDir}/remove-zk-node.sh $zkRoot
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
# contributor license agreements. See the NOTICE file distributed with
@ -27,8 +27,6 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
txt="''"
fi
declare -A workersGroupMap=()
workersGroup=(${workers//,/ })
for workerGroup in ${workersGroup[@]}
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
# contributor license agreements. See the NOTICE file distributed with
@ -21,8 +21,6 @@ workDir=`cd ${workDir};pwd`
source ${workDir}/env/install_env.sh
declare -A workersGroupMap=()
workersGroup=(${workers//,/ })
for workerGroup in ${workersGroup[@]}
do
@ -36,7 +34,7 @@ mastersHost=(${masters//,/ })
for master in ${mastersHost[@]}
do
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
@ -44,18 +42,18 @@ for worker in ${!workersGroupMap[*]}
do
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
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//,/ })
for apiServer in ${apiServersHost[@]}
do
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
# 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
# contributor license agreements. See the NOTICE file distributed with
@ -37,8 +37,6 @@ firstColumn="node server state"
echo $firstColumn
echo -e '\n'
declare -A workersGroupMap=()
workersGroup=(${workers//,/ })
for workerGroup in ${workersGroup[@]}
do
@ -52,25 +50,25 @@ StateRunning="Running"
mastersHost=(${masters//,/ })
for master in ${mastersHost[@]}
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"
done
# 2.worker server check state
for worker in ${!workersGroupMap[*]}
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"
done
# 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"
# 4.api server check state
apiServersHost=(${apiServers//,/ })
for apiServer in ${apiServersHost[@]}
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"
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
# contributor license agreements. See the NOTICE file distributed with
@ -21,8 +21,6 @@ workDir=`cd ${workDir};pwd`
source ${workDir}/env/install_env.sh
declare -A workersGroupMap=()
workersGroup=(${workers//,/ })
for workerGroup in ${workersGroup[@]}
do
@ -36,21 +34,21 @@ mastersHost=(${masters//,/ })
for master in ${mastersHost[@]}
do
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
for worker in ${!workersGroupMap[*]}
do
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
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//,/ })
for apiServer in ${apiServersHost[@]}
do
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

Loading…
Cancel
Save