ipfs-cluster/docker/random-killer.sh
Hector Sanjuan fe815bb9dc Use sh for docker test scripts
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai>
2017-10-21 00:11:47 +02:00

20 lines
410 B
Bash
Executable File

#!/bin/sh
# $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