30 lines
872 B
Bash
30 lines
872 B
Bash
#!/bin/sh
|
||
# Fake "algorithm3" — produces files the way the real GPU container would:
|
||
# a processed anomaly image + a results CSV every $INTERVAL seconds.
|
||
INTERVAL="${INTERVAL:-45}"
|
||
mkdir -p /out/image_root_dir /out/csv_files
|
||
|
||
N=0
|
||
while true; do
|
||
N=$((N + 1))
|
||
TS=$(date '+%Y%m%d_%H%M%S')
|
||
|
||
# Fake "image": random bytes, 100–500 KB, so transfers are visible in stats
|
||
SIZE_KB=$(( (N * 97) % 400 + 100 ))
|
||
dd if=/dev/urandom of="/out/image_root_dir/anomaly_${TS}.jpg" \
|
||
bs=1024 count="$SIZE_KB" 2>/dev/null
|
||
|
||
# Fake results CSV
|
||
{
|
||
echo "frame,chainage,class,confidence,timestamp"
|
||
i=0
|
||
while [ $i -lt 5 ]; do
|
||
i=$((i + 1))
|
||
echo "${N},${i}.$((N % 10)),pothole,0.$((70 + i)),${TS}"
|
||
done
|
||
} > "/out/csv_files/results_${TS}.csv"
|
||
|
||
echo "[generator] #${N}: anomaly_${TS}.jpg (${SIZE_KB}KB) + results_${TS}.csv"
|
||
sleep "$INTERVAL"
|
||
done
|