ipfs-cluster/docker/random-killer.sh
ZenGround0 6e4b325b35 Docker test image random reaper (#106)
* First draft of test dockerfile build

* Test dockerfile, build works, container runs and cluster tests go through

* Removed fifo for output

* renaming dockerfile

* Adding functionality for test 12
Added scripts and entrypoint mods to the testing docker image to allow for random shut down and startup
(both SIGSTOP and SIGINT) of the ipfs-cluster-service.

* test docker image ready for tests 12 and 13
2017-06-20 12:23:11 +02:00

20 lines
413 B
Bash
Executable File

#! /bin/bash
# $1=sleep time, $2=first command, $3=second command
# Loop forever
KILLED=1
sleep 2
while true; do
if [ "$(($RANDOM % 10))" -gt "4" ]; then
# Take down cluster
if [ "$KILLED" -eq "1" ]; then
KILLED=0
killall ipfs-cluster-service
else # Bring up cluster
KILLED=1
ipfs-cluster-service &
fi
fi
sleep 2.5
done