2023-01-24 16:37:06 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-01-25 11:10:26 +01:00
|
|
|
fifo=""
|
2023-01-24 16:37:06 +01:00
|
|
|
|
2023-01-25 11:10:26 +01:00
|
|
|
read_config() {
|
|
|
|
fifo_dir=$(cat "$1" | jq -r .fifo_dir)
|
|
|
|
if [ -z "$fifo_dir" ]; then
|
|
|
|
return 1
|
|
|
|
fi
|
2023-01-24 16:37:06 +01:00
|
|
|
|
2023-01-25 11:10:26 +01:00
|
|
|
fifo=$(cat "$1" | jq -r .fifo)
|
|
|
|
if [ -z "$fifo" ]; then
|
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
fifo="${fifo_dir}/$fifo"
|
|
|
|
return 0
|
|
|
|
}
|
2023-01-24 16:37:06 +01:00
|
|
|
|
2023-01-25 11:10:26 +01:00
|
|
|
if [ $# -ne 1 ] ; then
|
|
|
|
echo "Usage: $0 filename"
|
|
|
|
exit 1
|
2023-01-24 16:37:06 +01:00
|
|
|
else
|
2023-01-25 11:10:26 +01:00
|
|
|
if read_config "$1" ; then
|
|
|
|
if [[ ! -p $fifo ]]; then
|
|
|
|
echo "Reader not running on $fifo"
|
|
|
|
exit 1
|
|
|
|
fi
|
2022-06-05 12:27:57 +02:00
|
|
|
echo "Reader running on $fifo: update"
|
2023-01-25 11:10:26 +01:00
|
|
|
echo "update" >$fifo
|
|
|
|
exit 0
|
|
|
|
fi
|
2023-01-24 16:37:06 +01:00
|
|
|
fi
|