-
Notifications
You must be signed in to change notification settings - Fork 4
/
deploy_solution
executable file
·79 lines (70 loc) · 2.03 KB
/
deploy_solution
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
#set -ex
usage() {
echo "usage: $(basename $0) --sd <solution definition file name> "
exit 1;
}
while (( "$#" )); do
case $1 in
--sd )
solution_def_file=$2
shift
;;
* )
break ;;
esac
shift
done
echo "solution definition file="$solution_def_file
solution_args=$@
SERVICE_HOME_DIR=services
install_service(){
service_name=$1
dep_service="$2"
bd_ip=$3
bd_user=$4
service_arg1=$5
service_arg2=$6
service_arg3=$7
server=root@$bd_ip
args="$bd_user $service_arg1 $service_arg2 $service_arg3 $solution_args"
if [ "$dep_service" != "none" ] ; then
for i in $dep_service
do
scp -qr $SERVICE_HOME_DIR/$i $server:~/.
ssh $server "$i/install.sh $i $args" < /dev/null
ssh $server "$i/config.sh $i $args" < /dev/null
ssh $server "$i/start.sh $i $args" < /dev/null
ssh $server "$i/status.sh $i $args " < /dev/null
done
fi
scp -qr $SERVICE_HOME_DIR/$service_name $server:~/.
ssh $server "$service_name/install.sh $service_name $args" < /dev/null
ssh $server "$service_name/config.sh $service_name $args" < /dev/null
ssh $server "$service_name/start.sh $service_name $args" < /dev/null
echo "*** Service $service_name status: ***"
ssh $server "$service_name/status.sh $service_name $args " < /dev/null
scp -q common/* $server:~/$service
}
while IFS=',' read -r f1 f2 f3 f4 f5 f6 f7 f8 f9
do
## Ignore lines start with "#"
case $f1 in
\#*) continue;;
"") continue;;
esac
echo "************************************** "
echo "Service Name="$f1
echo " Required Service="$f2
echo " Service Location="$f3
echo " Service User Name="$f4
echo " arg1="$f5
echo " arg2="$f6
echo " arg3="$f7
echo "************************************** "
if [ -z "$f2" ]; then
f2="none"
fi
install_service $f1 "$f2" $f3 $f4 $f5 $f6 $f7
done < "$solution_def_file"
./solution_status --sd $solution_def_file