diff --git a/datasophon-api/src/main/resources/meta/DDP-1.0.0/DS/control_ds.sh b/datasophon-api/src/main/resources/meta/DDP-1.0.0/DS/control_ds.sh new file mode 100644 index 00000000..1f45d606 --- /dev/null +++ b/datasophon-api/src/main/resources/meta/DDP-1.0.0/DS/control_ds.sh @@ -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 diff --git a/datasophon-api/src/main/resources/meta/DDP-1.0.0/DS/service_ddl.json b/datasophon-api/src/main/resources/meta/DDP-1.0.0/DS/service_ddl.json index 2ae413fa..f659e2a5 100644 --- a/datasophon-api/src/main/resources/meta/DDP-1.0.0/DS/service_ddl.json +++ b/datasophon-api/src/main/resources/meta/DDP-1.0.0/DS/service_ddl.json @@ -17,7 +17,7 @@ "jmxPort": 12356, "startRunner": { "timeout": "60", - "program": "bin/dolphinscheduler-daemon.sh", + "program": "control_ds.sh", "args": [ "start", "api-server" @@ -25,7 +25,7 @@ }, "stopRunner": { "timeout": "600", - "program": "bin/dolphinscheduler-daemon.sh", + "program": "control_ds.sh", "args": [ "stop", "api-server" @@ -33,7 +33,7 @@ }, "statusRunner": { "timeout": "60", - "program": "bin/dolphinscheduler-daemon.sh", + "program": "control_ds.sh", "args": [ "status", "api-server" @@ -41,7 +41,7 @@ }, "restartRunner": { "timeout": "60", - "program": "control.sh", + "program": "control_ds.sh", "args": [ "restart", "api-server" @@ -62,7 +62,7 @@ "jmxPort": 12357, "startRunner": { "timeout": "60", - "program": "bin/dolphinscheduler-daemon.sh", + "program": "control_ds.sh", "args": [ "start", "master-server" @@ -70,7 +70,7 @@ }, "stopRunner": { "timeout": "600", - "program": "bin/dolphinscheduler-daemon.sh", + "program": "control_ds.sh", "args": [ "stop", "master-server" @@ -78,7 +78,7 @@ }, "statusRunner": { "timeout": "60", - "program": "bin/dolphinscheduler-daemon.sh", + "program": "control_ds.sh", "args": [ "status", "master-server" @@ -86,7 +86,7 @@ }, "restartRunner": { "timeout": "60", - "program": "control.sh", + "program": "control_ds.sh", "args": [ "restart", "master-server" @@ -102,7 +102,7 @@ "jmxPort": 12358, "startRunner": { "timeout": "60", - "program": "bin/dolphinscheduler-daemon.sh", + "program": "control_ds.sh", "args": [ "start", "worker-server" @@ -110,7 +110,7 @@ }, "stopRunner": { "timeout": "600", - "program": "bin/dolphinscheduler-daemon.sh", + "program": "control_ds.sh", "args": [ "stop", "worker-server" @@ -118,7 +118,7 @@ }, "statusRunner": { "timeout": "60", - "program": "bin/dolphinscheduler-daemon.sh", + "program": "control_ds.sh", "args": [ "status", "worker-server" @@ -126,7 +126,7 @@ }, "restartRunner": { "timeout": "60", - "program": "control.sh", + "program": "control_ds.sh", "args": [ "restart", "worker-server" @@ -142,7 +142,7 @@ "jmxPort": 12359, "startRunner": { "timeout": "60", - "program": "bin/dolphinscheduler-daemon.sh", + "program": "control_ds.sh", "args": [ "start", "alert-server" @@ -150,7 +150,7 @@ }, "stopRunner": { "timeout": "600", - "program": "bin/dolphinscheduler-daemon.sh", + "program": "control_ds.sh", "args": [ "stop", "alert-server" @@ -158,7 +158,7 @@ }, "statusRunner": { "timeout": "60", - "program": "bin/dolphinscheduler-daemon.sh", + "program": "control_ds.sh", "args": [ "status", "alert-server" @@ -166,7 +166,7 @@ }, "restartRunner": { "timeout": "60", - "program": "control.sh", + "program": "control_ds.sh", "args": [ "restart", "alert-server" @@ -516,4 +516,4 @@ "defaultValue": "" } ] -} \ No newline at end of file +}