Add fourth work package for REST API implementation
[anna.git] / example / diameter / launcher / deployments / ft-client / pre-start.sh
1 #!/bin/bash
2
3 # Remove logs:
4 rm *.log* *.csv 2>/dev/null
5
6 # Client sockets:
7 entity_dflt=`cat .entity 2>/dev/null`
8 entityServerSessions_dflt=`cat .entityServerSessions 2>/dev/null`
9
10 echo
11 echo
12 # If all have values:
13 if [ "$entity_dflt" != ""  -a "$entityServerSessions_dflt" != "" ]
14 then
15   echo "Do you wish to answer wizard commandline configuration ? (y/n) [n]:"
16   read wizard
17   [ "$wizard" = "" ] && wizard=n
18   [ "$wizard" = "n" ] && exit
19 fi
20
21 # DEFAULTS
22 #[ "$entity_dflt" = "" ] && entity_dflt="192.168.12.11:3868,192.168.12.21:3868"
23 [ "$entity_dflt" = "" ] && entity_dflt="localhost:3868"
24 [ "$entityServerSessions_dflt" = "" ] && entityServerSessions_dflt=1
25
26 # Wizard
27
28 # As client:
29 echo "Diameter entity server sessions (0: diameter entity disabled) [$entityServerSessions_dflt]:"
30 read entityServerSessions
31 [ "$entityServerSessions" = "" ] && entityServerSessions=$entityServerSessions_dflt
32
33 entity=
34 if test "$entityServerSessions" != "0"
35 then
36   echo "Target diameter entity (pipe-separated <ip|hostname>:<port> socket literal list) ["$entity_dflt"]:"
37   read entity
38 fi
39 [ "$entity" = "" ] && entity="$entity_dflt"
40
41 # Configure:
42 cat services.msk \
43   | sed 's/_ENTITY_/'$entity'/' \
44   | sed 's/_ENTITY_SERVER_SESSIONS_/'$entityServerSessions'/' \
45 > services.xml
46
47 echo
48 echo
49