docker-storcli-prometheus/entrypoint.sh

15 lines
292 B
Bash
Raw Normal View History

2018-05-18 12:39:17 -06:00
#!/bin/bash
usage() {
echo "usage: $0 <output_file> <interval>"
exit 2
}
[ $# -eq 2 ] || usage
trap 'kill -TERM $child 2>/dev/null' SIGTERM
while true; do
2018-05-18 12:49:51 -06:00
python /storcli.py > "$1.$$" &
2018-05-18 12:39:17 -06:00
child=$!; wait $child
2018-05-18 12:49:51 -06:00
mv "$1.$$" "$1"
2018-05-18 12:39:17 -06:00
sleep "$2" &
child=$!; wait $child
done