/
docker_bigfix_manyclients.sh
36 lines (29 loc) · 1.24 KB
/
docker_bigfix_manyclients.sh
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
#!/usr/bin/env bash
#
# This script, when run on a host with Docker installed, will run many of the same linux containers and install the BigFix client
# The goal is to get the maximum number of clients running on a given set of hardware for load testing
# By default, 10 docker containers will be created
# Related: https://github.com/bigfix/bfdocker/tree/master/besclient
# if $1 exists, then set RELAYFQDN
# http://www.tldp.org/LDP/abs/html/comparison-ops.html
if [ -n "$1" ]; then
RELAYFQDN=$1
else
# You can replace `alpha.bigfix.com` with your own BigFix root server or relay
RELAYFQDN=alpha.bigfix.com
fi
# https://stackoverflow.com/a/169602/861745
typeset -i i END
# set END of loop as parameter to script
if [ -n "$2" ]; then
let END=$2
else
let END=10
fi
let i=1
while ((i<=END)); do
sudo docker run -d --restart=unless-stopped centos bash -c "yum install initscripts -y;cd /tmp;curl -O https://raw.githubusercontent.com/jgstew/tools/master/bash/install_bigfix.sh;chmod u+x install_bigfix.sh;./install_bigfix.sh $RELAYFQDN;tail -f /dev/null;exit 0"
let i++
done # WHILE_END
# https://stackoverflow.com/questions/2935183/bash-infinite-sleep-infinite-blocking
# https://docs.docker.com/engine/reference/run/#restart-policies---restart