a01d1f0b7943d15a0f95d5a0660d52569998bb18
[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 # Stack:
11 dictionary_dflt=`cat .dictionary 2>/dev/null`
12
13 echo
14 echo
15 # If all have values:
16 if [ "$entity_dflt" != ""  -a "$entityServerSessions_dflt" != "" -a "$dictionary_dflt" != "" ]
17 then
18   echo "Do you wish to answer wizard commandline configuration ? (y/n) [n]:"
19   read wizard
20   [ "$wizard" = "" ] && wizard=n
21   [ "$wizard" = "n" ] && exit
22 fi
23
24 # DEFAULTS
25 #[ "$entity_dflt" = "" ] && entity_dflt="192.168.12.11:3868,192.168.12.21:3868"
26 [ "$entity_dflt" = "" ] && entity_dflt="localhost:3868"
27 [ "$entityServerSessions_dflt" = "" ] && entityServerSessions_dflt=1
28 [ "$dictionary_dflt" = "" ] && dictionary_dflt=dictionary.xml
29
30
31 # Wizard
32 echo "Diameter dictionary: you could use '/opt/bin/anna/example_diameter_stackManagement' tool in order to build"
33 echo " autonomous dictionaries for any kind of application. The key is to concatenate xml contents (ietf, 3gpp,"
34 echo " vendor-specific, etc.). See 'example/diameter/stackManagement/self_ruling_setups.sh' for this."
35 echo
36 echo "This launcher can also join them providing a comma-separated list (dictionaries available on ./stack)."
37 echo "By default, a QoS Application setup is suggested. Input the desired configuration instead, or press ENTER:"
38 echo
39 echo " [$dictionary_dflt]:"
40 read dictionary
41 [ "$dictionary" = "" ] && dictionary=$dictionary_dflt
42
43 # As client:
44 echo "Diameter entity server sessions (0: diameter entity disabled) [$entityServerSessions_dflt]:"
45 read entityServerSessions
46 [ "$entityServerSessions" = "" ] && entityServerSessions=$entityServerSessions_dflt
47
48 entity=
49 if test "$entityServerSessions" != "0"
50 then
51   echo "Target diameter entity (pipe-separated <ip|hostname>:<port> socket literal list) ["$entity_dflt"]:"
52   read entity
53 fi
54 [ "$entity" = "" ] && entity="$entity_dflt"
55
56 # Configure:
57 echo $dictionary > .dictionary
58 echo $entity > .entity
59 echo $entityServerSessions > .entityServerSessions
60
61 echo
62 echo
63