28 lines
629 B
Plaintext
28 lines
629 B
Plaintext
|
start()
|
||
|
{
|
||
|
socat -d -d pty,raw,echo=0,link=/tmp/ttyV0 pty,raw,echo=0,link=/tmp/ttyV1 < /dev/null > /dev/null &
|
||
|
}
|
||
|
|
||
|
stop()
|
||
|
{
|
||
|
while [ 1 ]; do
|
||
|
echo "* Stopping process..."
|
||
|
killall socat > /dev/null 2>&1
|
||
|
|
||
|
|
||
|
for r in 0 1 2 3 4 5 6 7 8 9; do
|
||
|
if [ -n "$(pidof socat)" ]; then
|
||
|
echo "* Waiting for process to exit ($r)..."
|
||
|
sleep 1
|
||
|
else
|
||
|
echo "* Process not running."
|
||
|
return 1
|
||
|
fi
|
||
|
done
|
||
|
|
||
|
echo "* Forcing exit..."
|
||
|
killall -9 socat > /dev/null 2>&1
|
||
|
sleep 1
|
||
|
done
|
||
|
}
|