summaryrefslogtreecommitdiff
path: root/log-stream/stop.sh
diff options
context:
space:
mode:
Diffstat (limited to 'log-stream/stop.sh')
-rw-r--r--log-stream/stop.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/log-stream/stop.sh b/log-stream/stop.sh
new file mode 100644
index 0000000..c3c45dc
--- /dev/null
+++ b/log-stream/stop.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+if [ ! -n "$1" ]
+then
+ echo -e "\033[33mUsage: sh $0 config/\033[0m"
+ exit
+fi
+
+#!/bin/bash
+#flink任务停止脚本
+source /etc/profile
+
+function read_dir(){
+for file in `ls $1` #注意此处这是两个反引号,表示运行系统命令
+do
+ if [ -d "$1$file" ] #注意此处之间一定要加上空格,否则会报错
+ then
+ read_dir $1$file
+ else
+ if [ `flink list | grep "$file" | awk '{print $4}' | wc -l` -ne 0 ]
+ then
+ echo -e "\033[33mstoping job $file\033[0m"
+ flink list | grep "$file" | awk '{print $4}' | xargs flink cancel
+ echo -e "\033[32mstoped job $file\033[0m"
+ fi
+ fi
+done
+}
+#读取第一个参数 为配置文件目录名
+read_dir $1