Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 202 lines (182 sloc) 5.527 kb
c8b5ae0c » nniclausse
2006-02-24 use env
1 #!/usr/bin/env bash
748e9e03 » nniclausse
2004-02-11 major source reorganisation to ease debian packaging
2
ea000685 » nniclausse
2005-08-16 use bash; solaris does not like 'hostname -s' (jasonwtucker@gmail.com)
3 UNAME=`uname`
4 case $UNAME in
c1163bd5 » nniclausse
2010-03-05 add gen_server to choose local ports to bypass the 64K limit.
5 "Linux")
6 HOST=`hostname -s 2>/dev/null`
7 RET=$?
8 if [ $RET != 0 ]; then
9 HOST=`hostname`
10 echo "WARN: hostname -s failed, use '$HOST' as hostname" > /dev/stderr
11 fi
12 ;;
3027f827 » nniclausse
2005-08-16 argh
13 "SunOS") HOST=`hostname`;;
14 *) HOST=`hostname -s`;;
ea000685 » nniclausse
2005-08-16 use bash; solaris does not like 'hostname -s' (jasonwtucker@gmail.com)
15 esac
748e9e03 » nniclausse
2004-02-11 major source reorganisation to ease debian packaging
16
9bf3b0c2 » nniclausse
2011-05-18 fix libdir (can be lib64 on some OS)
17 INSTALL_DIR=@EXPANDED_LIBDIR@/erlang/
13dfdfdc » nniclausse
2005-04-29 update configure & Makefile
18 ERL=@ERL@
5345a3b5 » nniclausse
2005-11-27 rename idx-tsunami to tsung step 3
19 MAIN_DIR=$HOME/.tsung
76b47d66 » nniclausse
2004-02-13 save session in main directory instead of log
20 LOG_DIR=$MAIN_DIR/log
5345a3b5 » nniclausse
2005-11-27 rename idx-tsunami to tsung step 3
21 LOG_OPT="log_file \"$LOG_DIR/tsung.log\""
13dfdfdc » nniclausse
2005-04-29 update configure & Makefile
22 VERSION=@PACKAGE_VERSION@
d38c657e » nniclausse
2008-07-15 can use FQDN (-name instead of -sname) with -F flag
23 NAMETYPE="-sname"
748e9e03 » nniclausse
2004-02-11 major source reorganisation to ease debian packaging
24
25 LISTEN_PORT=8090
3493e621 » nniclausse
2007-06-21 add parent proxy support for http: first step (TSUN-37)
26 USE_PARENT_PROXY=false
eff2fce8 » nniclausse
2006-06-13 listening port and dest IP (for pgsql recorder) can be set at runtime…
27 PGSQL_SERVER_IP=127.0.0.1
af90734f » nniclausse
2006-08-08 pgsql recorder: server port can be set with -P (listening port option…
28 PGSQL_SERVER_PORT=5432
5345a3b5 » nniclausse
2005-11-27 rename idx-tsunami to tsung step 3
29 NAME=tsung
30 CONTROLLER=tsung_controller
688f3c98 » nniclausse
2008-11-27 disable smp by default on client beams (TSUN-97)
31 SMP_DISABLE=true
c1163bd5 » nniclausse
2010-03-05 add gen_server to choose local ports to bypass the 64K limit.
32 WARM_TIME=10
748e9e03 » nniclausse
2004-02-11 major source reorganisation to ease debian packaging
33
5345a3b5 » nniclausse
2005-11-27 rename idx-tsunami to tsung step 3
34 TSUNGPATH=$INSTALL_DIR/lib/tsung-$VERSION/ebin
35 CONTROLLERPATH=$INSTALL_DIR/lib/tsung_controller-$VERSION/ebin
748e9e03 » nniclausse
2004-02-11 major source reorganisation to ease debian packaging
36
5345a3b5 » nniclausse
2005-11-27 rename idx-tsunami to tsung step 3
37 CONF_OPT_FILE="$HOME/.tsung/tsung.xml"
38 BOOT_OPT="-boot $INSTALL_DIR/lib/tsung_controller-$VERSION/priv/tsung_controller -boot_var TSUNGPATH $INSTALL_DIR "
a68c3e67 » nniclausse
2006-02-21 initial debug level also for controller
39 DEBUG_LEVEL=5
95fb1730 » nniclausse
2004-12-10 add -r option to set the command for starting nodes on remote host (s…
40 ERL_RSH=" -rsh ssh "
c1163bd5 » nniclausse
2010-03-05 add gen_server to choose local ports to bypass the 64K limit.
41 ERL_DIST_PORTS=" -kernel inet_dist_listen_min 64000 -kernel inet_dist_listen_max 65500 "
5c180b22 » nniclausse
2010-08-06 Merge branch 'localports' into start-sequence
42 ERL_OPTS=" $ERL_DIST_PORTS -smp auto +P 250000 +A 16 +K true @ERL_OPTS@ "
5345a3b5 » nniclausse
2005-11-27 rename idx-tsunami to tsung step 3
43 COOKIE='tsung'
12f1e4d2 » nniclausse
2006-05-03 fix tr args for solaris
44 ERTS_RUN=`$ERL -version 2>&1 | tr -cd 0123456789.`
4c0948f4 » nniclausse
2009-03-05 split tsung command into tsung and tsung-recorder (TSUN-113)
45 ERTS_BOOT=`grep erts $TSUNGPATH/../priv/tsung.rel 2> /dev/null| tr -cd 0123456789.`
748e9e03 » nniclausse
2004-02-11 major source reorganisation to ease debian packaging
46
47 stop() {
d38c657e » nniclausse
2008-07-15 can use FQDN (-name instead of -sname) with -F flag
48 $ERL $ERL_OPTS $ERL_RSH -noshell $NAMETYPE killer -setcookie $COOKIE -pa $TSUNGPATH -pa $CONTROLLERPATH -s tsung_controller stop_all $HOST -s init stop
748e9e03 » nniclausse
2004-02-11 major source reorganisation to ease debian packaging
49 }
50
0964e946 » nniclausse
2005-11-04 detect version of erlang in boot script and rebuild them if needed
51 checkversion() {
0992b822 » nniclausse
2005-11-13 check if recorder is already running
52 if [ $ERTS_RUN != $ERTS_BOOT ]
0964e946 » nniclausse
2005-11-04 detect version of erlang in boot script and rebuild them if needed
53 then
3493e621 » nniclausse
2007-06-21 add parent proxy support for http: first step (TSUN-37)
54 echo "Erlang version has changed ! [$ERTS_BOOT] != [$ERTS_RUN]"
55 echo "Must create new boot files (you may have to run this one time as root ! )"
56 makebootfiles
0992b822 » nniclausse
2005-11-13 check if recorder is already running
57 fi
0964e946 » nniclausse
2005-11-04 detect version of erlang in boot script and rebuild them if needed
58 }
59
60 makebootfiles() {
5345a3b5 » nniclausse
2005-11-27 rename idx-tsunami to tsung step 3
61 cd $TSUNGPATH/..
62 echo "creating boot file for tsung application"
63 $ERL $ERL_OPTS -noshell -pa $TSUNGPATH -s builder go -s init stop > /dev/null
0964e946 » nniclausse
2005-11-04 detect version of erlang in boot script and rebuild them if needed
64 cd $CONTROLLERPATH/..
5345a3b5 » nniclausse
2005-11-27 rename idx-tsunami to tsung step 3
65 echo "creating boot file for tsung_controller application"
66 $ERL $ERL_OPTS -noshell -pa $TSUNGPATH -s builder go -s init stop > /dev/null
0964e946 » nniclausse
2005-11-04 detect version of erlang in boot script and rebuild them if needed
67 }
68
748e9e03 » nniclausse
2004-02-11 major source reorganisation to ease debian packaging
69 start() {
3493e621 » nniclausse
2007-06-21 add parent proxy support for http: first step (TSUN-37)
70 echo "Starting Tsung"
d38c657e » nniclausse
2008-07-15 can use FQDN (-name instead of -sname) with -F flag
71 $ERL $ERL_OPTS $ERL_RSH -noshell $NAMETYPE $CONTROLLER -setcookie $COOKIE $BOOT_OPT \
5345a3b5 » nniclausse
2005-11-27 rename idx-tsunami to tsung step 3
72 -pa $TSUNGPATH -pa $CONTROLLERPATH \
a27bb83c » nniclausse
2009-03-18 fix env. name for smp
73 -tsung_controller smp_disable $SMP_DISABLE \
a68c3e67 » nniclausse
2006-02-21 initial debug level also for controller
74 -tsung_controller debug_level $DEBUG_LEVEL \
c1163bd5 » nniclausse
2010-03-05 add gen_server to choose local ports to bypass the 64K limit.
75 -tsung_controller warm_time $WARM_TIME \
5345a3b5 » nniclausse
2005-11-27 rename idx-tsunami to tsung step 3
76 -tsung_controller config_file \"$CONF_OPT_FILE\" -tsung_controller $LOG_OPT
748e9e03 » nniclausse
2004-02-11 major source reorganisation to ease debian packaging
77 }
78
7fbd71d7 » nniclausse
2004-03-31 check if config file exist
79 debug() {
d38c657e » nniclausse
2008-07-15 can use FQDN (-name instead of -sname) with -F flag
80 $ERL $ERL_OPTS $ERL_RSH $NAMETYPE $CONTROLLER -setcookie $COOKIE $BOOT_OPT \
5345a3b5 » nniclausse
2005-11-27 rename idx-tsunami to tsung step 3
81 -pa $TSUNGPATH -pa $CONTROLLERPATH \
82 -tsung_controller config_file \"$CONF_OPT_FILE\" \
83 -tsung_controller $LOG_OPT
7fbd71d7 » nniclausse
2004-03-31 check if config file exist
84 }
85
13dfdfdc » nniclausse
2005-04-29 update configure & Makefile
86 version() {
4c0948f4 » nniclausse
2009-03-05 split tsung command into tsung and tsung-recorder (TSUN-113)
87 echo "Tsung version $VERSION"
88 exit 0
13dfdfdc » nniclausse
2005-04-29 update configure & Makefile
89 }
90
7fbd71d7 » nniclausse
2004-03-31 check if config file exist
91 checkconfig() {
3493e621 » nniclausse
2007-06-21 add parent proxy support for http: first step (TSUN-37)
92 if [ ! -e $CONF_OPT_FILE ]
93 then
94 echo "Config file $CONF_OPT_FILE doesn't exist, aborting !"
95 exit 1
96 fi
7fbd71d7 » nniclausse
2004-03-31 check if config file exist
97 }
98
1ffd1ecc » nniclausse
2004-03-18 add configure scripts to detect erlang installation directory and com…
99 maindir() {
3493e621 » nniclausse
2007-06-21 add parent proxy support for http: first step (TSUN-37)
100 if [ ! -d $MAIN_DIR ]
101 then
102 echo "Creating local Tsung directory $MAIN_DIR"
103 mkdir $MAIN_DIR
104 fi
1ffd1ecc » nniclausse
2004-03-18 add configure scripts to detect erlang installation directory and com…
105 }
7fbd71d7 » nniclausse
2004-03-31 check if config file exist
106
748e9e03 » nniclausse
2004-02-11 major source reorganisation to ease debian packaging
107 logdir() {
108 if [ ! -d $LOG_DIR ]
109 then
5345a3b5 » nniclausse
2005-11-27 rename idx-tsunami to tsung step 3
110 echo "Creating Tsung log directory $LOG_DIR"
748e9e03 » nniclausse
2004-02-11 major source reorganisation to ease debian packaging
111 mkdir $LOG_DIR
112 fi
113 }
114
115 status() {
5345a3b5 » nniclausse
2005-11-27 rename idx-tsunami to tsung step 3
116 SNAME=tsung_status_$RANDOM
d38c657e » nniclausse
2008-07-15 can use FQDN (-name instead of -sname) with -F flag
117 $ERL -noshell $NAMETYPE $SNAME -setcookie $COOKIE -pa $TSUNGPATH -pa $CONTROLLERPATH -s tsung_controller status $HOST -s init stop
748e9e03 » nniclausse
2004-02-11 major source reorganisation to ease debian packaging
118 }
119
0992b822 » nniclausse
2005-11-13 check if recorder is already running
120 checkrunning_controller() {
121 RES=`status`
c65d43c4 » nniclausse
2005-12-05 fix output msg; fix usage.
122 if [ "$RES" != "Tsung is not started" ]; then
5345a3b5 » nniclausse
2005-11-27 rename idx-tsunami to tsung step 3
123 echo "Tsung is already running, exit."
0992b822 » nniclausse
2005-11-13 check if recorder is already running
124 exit 1
125 fi
126 }
127
748e9e03 » nniclausse
2004-02-11 major source reorganisation to ease debian packaging
128 usage() {
c65d43c4 » nniclausse
2005-12-05 fix output msg; fix usage.
129 prog=`basename $0`
4c0948f4 » nniclausse
2009-03-05 split tsung command into tsung and tsung-recorder (TSUN-113)
130 echo "Usage: $prog <options> start|stop|debug|status"
131 echo "Options:"
132 echo " -f <file> set configuration file (default is ~/.tsung/tsung.xml)"
e60ee84e » nniclausse
2009-04-20 add doc for -F option
133 echo " -l <logfile> set log file (default is ~/.tsung/log/YYYYMMDD-HH:MM/tsung.log)"
e0bd0f1f » nniclausse
2009-04-04 add an option to set an unique id in the erlang nodes name (TSUN-116)
134 echo " -i <id> set controller id (default is empty)"
c1163bd5 » nniclausse
2010-03-05 add gen_server to choose local ports to bypass the 64K limit.
135 echo " -i <id> set controller id (default is empty)"
4c0948f4 » nniclausse
2009-03-05 split tsung command into tsung and tsung-recorder (TSUN-113)
136 echo " -r <command> set remote connector (default is ssh)"
239c2c30 » nniclausse
2010-03-05 add option to enable smp on client beams (controller is already smp)
137 echo " -s enable erlang smp on client nodes"
e60ee84e » nniclausse
2009-04-20 add doc for -F option
138 echo " -F use long names (FQDN) for erlang nodes"
c1163bd5 » nniclausse
2010-03-05 add gen_server to choose local ports to bypass the 64K limit.
139 echo " -w warmup delay (default is 10 sec)"
4c0948f4 » nniclausse
2009-03-05 split tsung command into tsung and tsung-recorder (TSUN-113)
140 echo " -v print version information and exit"
141 echo " -h display this help and exit"
c65d43c4 » nniclausse
2005-12-05 fix output msg; fix usage.
142 exit
748e9e03 » nniclausse
2004-02-11 major source reorganisation to ease debian packaging
143 }
144
c1163bd5 » nniclausse
2010-03-05 add gen_server to choose local ports to bypass the 64K limit.
145 while getopts "vhf:l:d:r:i:Fsw:" Option
748e9e03 » nniclausse
2004-02-11 major source reorganisation to ease debian packaging
146 do
147 case $Option in
7fbd71d7 » nniclausse
2004-03-31 check if config file exist
148 f) CONF_OPT_FILE=$OPTARG;;
459db7e9 » nniclausse
2008-03-28 absolute path needed for logfile name (fix TSUN-57)
149 l) # must add absolute path
150 echo "$OPTARG" | grep -q "^/"
151 RES=$?
152 if [ "$RES" == 0 ]; then
153 LOG_OPT="log_file \"$OPTARG\" "
154 else
155 LOG_OPT="log_file \"$PWD/$OPTARG\" "
156 fi
157 ;;
a68c3e67 » nniclausse
2006-02-21 initial debug level also for controller
158 d) DEBUG_LEVEL=$OPTARG;;
95fb1730 » nniclausse
2004-12-10 add -r option to set the command for starting nodes on remote host (s…
159 r) ERL_RSH=" -rsh $OPTARG ";;
d38c657e » nniclausse
2008-07-15 can use FQDN (-name instead of -sname) with -F flag
160 F) NAMETYPE="-name";;
c1163bd5 » nniclausse
2010-03-05 add gen_server to choose local ports to bypass the 64K limit.
161 w) WARM_TIME=$OPTARG;;
239c2c30 » nniclausse
2010-03-05 add option to enable smp on client beams (controller is already smp)
162 s) SMP_DISABLE="false";;
4c0948f4 » nniclausse
2009-03-05 split tsung command into tsung and tsung-recorder (TSUN-113)
163 v) version;;
e0bd0f1f » nniclausse
2009-04-04 add an option to set an unique id in the erlang nodes name (TSUN-116)
164 i) ID=$OPTARG
165 COOKIE=$COOKIE"_"$ID
166 CONTROLLER=$CONTROLLER"_"$ID
167 ;;
4c0948f4 » nniclausse
2009-03-05 split tsung command into tsung and tsung-recorder (TSUN-113)
168 h) usage;;
f2c04e92 » nniclausse
2004-02-12 argh, stupid typo
169 *) usage ;;
748e9e03 » nniclausse
2004-02-11 major source reorganisation to ease debian packaging
170 esac
3493e621 » nniclausse
2007-06-21 add parent proxy support for http: first step (TSUN-37)
171 done
748e9e03 » nniclausse
2004-02-11 major source reorganisation to ease debian packaging
172 shift $(($OPTIND - 1))
173
174 case $1 in
175 start)
0992b822 » nniclausse
2005-11-13 check if recorder is already running
176 checkconfig
177 checkversion
1ffd1ecc » nniclausse
2004-03-18 add configure scripts to detect erlang installation directory and com…
178 maindir
748e9e03 » nniclausse
2004-02-11 major source reorganisation to ease debian packaging
179 logdir
180 start
181 ;;
0964e946 » nniclausse
2005-11-04 detect version of erlang in boot script and rebuild them if needed
182 boot)
0992b822 » nniclausse
2005-11-13 check if recorder is already running
183 checkversion
184 ;;
0964e946 » nniclausse
2005-11-04 detect version of erlang in boot script and rebuild them if needed
185
748e9e03 » nniclausse
2004-02-11 major source reorganisation to ease debian packaging
186 debug)
0992b822 » nniclausse
2005-11-13 check if recorder is already running
187 checkconfig
188 checkversion
1ffd1ecc » nniclausse
2004-03-18 add configure scripts to detect erlang installation directory and com…
189 maindir
748e9e03 » nniclausse
2004-02-11 major source reorganisation to ease debian packaging
190 logdir
191 debug
192 ;;
193 stop)
194 stop
195 ;;
196 status)
197 status
198 ;;
199 *)
200 usage $0
201 ;;
202 esac
Something went wrong with that request. Please try again.