-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathparallel.bash
More file actions
43 lines (32 loc) · 858 Bytes
/
parallel.bash
File metadata and controls
43 lines (32 loc) · 858 Bytes
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
37
38
39
40
#!/bin/bash
## Copyright (C) 1997-2018 Reyesoft <info@reyesoft.com>.
## This file is part of a Reyesoft Project. This can not be copied and/or
## distributed without the express permission of Reyesoft
## usage
# bash parallel.sh [-s] ..."script 1"
# -s Stop on first fails
## params
## https://stackoverflow.com/questions/16483119/an-example-of-how-to-use-getopts-in-bash?answertab=votes#tab-top
while getopts ":s" o; do
case "${o}" in
s)
stop=1
;;
esac
done
shift $((OPTIND-1))
## fix problem when parallel.bash runs inside a composer script
sleep .1 &
## includes
DIR=`dirname "$(readlink -f "$0")"`
source ${DIR}/lib/runners.bash
if [ "${stop}" ] ; then
parallel_and_stop "$@"
RC=$?
## fix when like composer script
kill -TERM 0
exit $RC
else
echo nostop
parallel "$@"
fi;