From 5784fe6123dc17d8005e1e1c9cdb4de4c3f80d3f Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Thu, 15 Jul 2021 21:35:20 +0200 Subject: WIP pd_manager update --- src/pd_manager.sh | 24 +++++++++--------------- src/pd_manager_run.sh | 3 ++- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/pd_manager.sh b/src/pd_manager.sh index 6260c3f..3cbf72a 100755 --- a/src/pd_manager.sh +++ b/src/pd_manager.sh @@ -1,31 +1,25 @@ #!/bin/sh -delay=0.05 IFS="," -hour="$(( 3600 ))" -day="$(( 24 * $hour ))" -#preferred="$(( 5 * $hour ))" -#valid="$(( $preferred + 10 * $hour ))" -preferred="$(( 1 * $day ))" -valid="$(( $preferred + 1 * $day ))" +day="$(( 3600 * 24 ))" +preferred="$(( $day ))" +valid="$(( $preferred + $day ))" output="" -add_prefix() { +write_prefix() { local prefix=$1 res="$prefix,$preferred,$valid," - /bin/echo ">$res" >> ./pd_manager.log + echo ">$res" >> /root/pd_manager.log output="$output$res\n" } read duid iaid read prefix res1 res2 -echo "<$duid $iaid $prefix $res1 $res2" >> ./pd_manager.log +echo "<$duid $iaid $prefix $res1 $res2" >> /root/pd_manager.log -sleep $delay -add_prefix "2001:0470:de6f:1234::/64" -add_prefix "2001:0470:de17:1234::/64" -/bin/echo -e -n "$output\n\n" -sleep $delay +write_prefix "2001:0470:de6f:1234::/64" +write_prefix "2001:0470:de17:1234::/64" +echo -e -n "$output\n\n" exit 0 diff --git a/src/pd_manager_run.sh b/src/pd_manager_run.sh index 53ab4c6..5ef0a05 100755 --- a/src/pd_manager_run.sh +++ b/src/pd_manager_run.sh @@ -1,4 +1,5 @@ #!/bin/sh -socat -v TCP-LISTEN:1234,reuseport,fork EXEC:./pd_manager.sh +socat UNIX-LISTEN:/tmp/pd_manager,fork EXEC:/root/pd_manager.sh +#socat -v UNIX-LISTEN:/tmp/pd_manager,fork TCP-CONNECT:10.49.160.1:1234 -- cgit v1.2.3