Skip to content

Commit 94a2c0e

Browse files
committed
Don't bother with netcat, which may not be installed, when we can use
special devices which bash will happily emulate if not found.
1 parent c4721b4 commit 94a2c0e

File tree

1 file changed

+4
-28
lines changed

1 file changed

+4
-28
lines changed

src/psij/executors/batch/common/batch_lib.mustache

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,10 @@
1-
_UPDATE_MODE="none"
2-
31
update_status() {
42
STATUS="$1"
5-
if [ "$_UPDATE_MODE" == "none" ]; then
6-
NCPROBE=`nc -h 2>&1`
7-
EC=$?
8-
if [ "$EC" == "0" ]; then
9-
if echo $NCPROBE | grep "send-only" >/dev/null 2>&1 ; then
10-
_UPDATE_MODE="nc1"
11-
else
12-
_UPDATE_MODE="nc2"
13-
fi
14-
else
15-
_UPDATE_MODE="file"
16-
fi
17-
fi
183
19-
if [ "$_UPDATE_MODE" == "nc1" ]; then
20-
ADDRS={{psij.us_addrs}}
21-
for ADDR in ${ADDRS//,/ }; do
22-
echo "{{job.id}} $STATUS" | nc --send-only -4 -u $ADDR {{psij.us_port}}
23-
done
24-
elif [ "$_UPDATE_MODE" == "nc2" ]; then
25-
ADDRS={{psij.us_addrs}}
26-
for ADDR in ${ADDRS//,/ }; do
27-
echo "{{job.id}} $STATUS" | nc -q0 -u $ADDR {{psij.us_port}}
28-
done
29-
else
30-
echo "{{job.id}} $STATUS" >> {{psij.us_file}}
31-
fi
4+
ADDRS={{psij.us_addrs}}
5+
for ADDR in ${ADDRS//,/ }; do
6+
echo "{{job.id}} $STATUS" >/dev/udp/$ADDR/{{psij.us_port}}
7+
done
328
}
339

3410
fail() {

0 commit comments

Comments
 (0)