Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement-238 add dolphinscheduler script control_ds.sh #245

Merged
merged 11 commits into from
Apr 24, 2023
90 changes: 90 additions & 0 deletions datasophon-api/src/main/resources/meta/DDP-1.0.0/DS/control_ds.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#!/usr/bin/env bash
current_path=$(cd `dirname $0`;pwd)
command=$1
shift
option=$1
cd $current_path
state=""
function prepareEnv() {
process_name=$1
source /etc/profile
if [ -n "$HADOOP_HOME" ]
then
echo "sync hive conf "
cp $HADOOP_HOME/etc/hadoop/core-site.xml $current_path/$process_name/conf/
cp $HADOOP_HOME/etc/hadoop/hdfs-site.xml $current_path/$process_name/conf/
fi
}

function start() {

process_name=$1
prepareEnv $process_name
execStatus $process_name
if [ $state -eq 0 ]
then
echo "ERROR: $process_name is running"
exit 1
fi
$current_path/bin/dolphinscheduler-daemon.sh start $process_name
}

function stop() {
process_name=$1
execStatus $process_name
if [ $state -eq 1 ]
then
echo "ERROR: $process_name is not running"
exit 1
fi
$current_path/bin/dolphinscheduler-daemon.sh stop $process_name
}

function status() {
process_name=$1
execStatus $process_name
if [ $state -eq 1 ]
then
echo "INFO: $process_name is not running"
exit 1
elif [ $state -eq 0 ]
then
echo "INFO: $process_name is running"
exit 0
fi
}
function execStatus() {
process_name=$1
status=` $current_path/bin/dolphinscheduler-daemon.sh status $process_name | grep -v Begin | grep -v End | cut -d " " -f5`
if [[ $status=="STOP" ]]
then
state=1
fi
if [[ $status=="RUNNING" ]]
then
state=0
fi
}


function restart() {
stop $1
start $1
}



case $command in
start)
start $option
;;
stop)
stop $option
;;
status)
status $option
;;
restart)
restart $option
;;
esac
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,31 @@
"jmxPort": 12356,
"startRunner": {
"timeout": "60",
"program": "bin/dolphinscheduler-daemon.sh",
"program": "control_ds.sh",
"args": [
"start",
"api-server"
]
},
"stopRunner": {
"timeout": "600",
"program": "bin/dolphinscheduler-daemon.sh",
"program": "control_ds.sh",
"args": [
"stop",
"api-server"
]
},
"statusRunner": {
"timeout": "60",
"program": "bin/dolphinscheduler-daemon.sh",
"program": "control_ds.sh",
"args": [
"status",
"api-server"
]
},
"restartRunner": {
"timeout": "60",
"program": "control.sh",
"program": "control_ds.sh",
"args": [
"restart",
"api-server"
Expand All @@ -62,31 +62,31 @@
"jmxPort": 12357,
"startRunner": {
"timeout": "60",
"program": "bin/dolphinscheduler-daemon.sh",
"program": "control_ds.sh",
"args": [
"start",
"master-server"
]
},
"stopRunner": {
"timeout": "600",
"program": "bin/dolphinscheduler-daemon.sh",
"program": "control_ds.sh",
"args": [
"stop",
"master-server"
]
},
"statusRunner": {
"timeout": "60",
"program": "bin/dolphinscheduler-daemon.sh",
"program": "control_ds.sh",
"args": [
"status",
"master-server"
]
},
"restartRunner": {
"timeout": "60",
"program": "control.sh",
"program": "control_ds.sh",
"args": [
"restart",
"master-server"
Expand All @@ -102,31 +102,31 @@
"jmxPort": 12358,
"startRunner": {
"timeout": "60",
"program": "bin/dolphinscheduler-daemon.sh",
"program": "control_ds.sh",
"args": [
"start",
"worker-server"
]
},
"stopRunner": {
"timeout": "600",
"program": "bin/dolphinscheduler-daemon.sh",
"program": "control_ds.sh",
"args": [
"stop",
"worker-server"
]
},
"statusRunner": {
"timeout": "60",
"program": "bin/dolphinscheduler-daemon.sh",
"program": "control_ds.sh",
"args": [
"status",
"worker-server"
]
},
"restartRunner": {
"timeout": "60",
"program": "control.sh",
"program": "control_ds.sh",
"args": [
"restart",
"worker-server"
Expand All @@ -142,31 +142,31 @@
"jmxPort": 12359,
"startRunner": {
"timeout": "60",
"program": "bin/dolphinscheduler-daemon.sh",
"program": "control_ds.sh",
"args": [
"start",
"alert-server"
]
},
"stopRunner": {
"timeout": "600",
"program": "bin/dolphinscheduler-daemon.sh",
"program": "control_ds.sh",
"args": [
"stop",
"alert-server"
]
},
"statusRunner": {
"timeout": "60",
"program": "bin/dolphinscheduler-daemon.sh",
"program": "control_ds.sh",
"args": [
"status",
"alert-server"
]
},
"restartRunner": {
"timeout": "60",
"program": "control.sh",
"program": "control_ds.sh",
"args": [
"restart",
"alert-server"
Expand Down Expand Up @@ -516,4 +516,4 @@
"defaultValue": ""
}
]
}
}