K
K
kazharskiy2018-10-08 07:38:10
linux
kazharskiy, 2018-10-08 07:38:10

Why does the script stop working after execution?

There is a TP-Link 3020 router with OpenWrt installed on it. A GSM modem is connected to the USB port of the router, which transmits the phone number via USB when an incoming call and opens the gate in parallel.
In /etc/rc.local script launch is registered The script
./test.sh &
itself

#!/bin/sh
cat /dev/ttyUSB0 | while read DATA; do
  if echo $DATA | grep -q +7; then
        DATEFORMAT=$(date '+%m/%d/%y %H:%M:%S')
        echo $DATA $DATEFORMAT >> /www/1.txt
  fi
done

The phone number and date are written to the 1.txt file, and after that the script stops working, after rebooting the device, it again writes the number 1 time and that's it.
I watched the running processes, after the call the process is unloaded. Can you tell me how to catch the error or what could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2018-10-08
@Tabletko

Why does he have to keep working? The script describes one-time actions and there are no cycles.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question