Browse Source

add crawler etl shell

qingqu-git 1 năm trước cách đây
mục cha
commit
e50bfe1024
1 tập tin đã thay đổi với 20 bổ sung2 xóa
  1. 20 2
      crawler-etl.sh

+ 20 - 2
crawler-etl.sh

@@ -1,4 +1,19 @@
 #/bin/bash
+
+deploy() {
+    ips=($@)
+    for i in "${!ips[@]}"
+    do
+        if [ $i -gt 1 ]; then
+            ip=${ips[$i]}
+            echo $ip "发布中..."
+            scp /home/server-deploy/crawler-etl.sh $ip:/home/crawler-etl.sh
+            ssh $ip "sh /home/crawler-etl.sh restart $2"
+            echo $ip "发布完成!"
+        fi
+    done
+}
+
 start() {
     CID=$(docker ps -a | grep crawler-etl | awk '{print $1}')
     if [ ! $CID ]; then
@@ -37,14 +52,17 @@ update() {
 }
 
 case "$1" in
+'deploy')
+    deploy $@
+    ;;
 'start')
     start $2
     ;;
 'stop')
-    stop $2
+    stop
     ;;
 'restart')
-    stop $2
+    stop
     start $2
     ;;
 'update')