From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.github.com (out-25.smtp.github.com [192.30.252.208]) by mail.toke.dk (Postfix) with ESMTPS id E019D8BC27A for ; Tue, 14 Sep 2021 12:46:52 +0200 (CEST) Authentication-Results: mail.toke.dk; dkim=pass (1024-bit key) header.d=github.com header.i=@github.com header.b=A6PaoEVA Received: from github-lowworker-cde56e0.va3-iad.github.net (github-lowworker-cde56e0.va3-iad.github.net [10.48.25.52]) by smtp.github.com (Postfix) with ESMTP id D416C840A88 for ; Tue, 14 Sep 2021 03:46:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=github.com; s=pf2014; t=1631616410; bh=4MeE1/6kEk5qNL/rwy6kOa4/sZVx91v57JTek6plTAM=; h=Date:From:Reply-To:To:Cc:In-Reply-To:References:Subject:List-ID: List-Archive:List-Post:List-Unsubscribe:From; b=A6PaoEVAoW07LK14Oi23M6ejo1iEatH5HQ1wke2woSl+aGHTjBysYLsKga5P6L0KN MI6vIcl8Qh7WvhedzsVVI4Jw7OkSVrqix/pBmV1V0E9N4EpKyq+R9Phjc0yy17xtFN PTXC2u9KjfkKmXI4mHNfX/v7K/TnzTB8tUtZNPoc= Date: Tue, 14 Sep 2021 03:46:50 -0700 From: =?UTF-8?B?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2Vu?= To: tohojo/flent Message-ID: In-Reply-To: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="--==_mimepart_61407d9ac6853_26a5c7883751b0"; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: list X-GitHub-Sender: tohojo X-GitHub-Recipient: flent-users X-GitHub-Reason: subscribed X-Auto-Response-Suppress: All X-GitHub-Recipient-Address: flent-users@flent.org Message-ID-Hash: VXGIQ2P7QIV7XDHVI3PULSTUZAVZI4MC X-Message-ID-Hash: VXGIQ2P7QIV7XDHVI3PULSTUZAVZI4MC X-MailFrom: noreply@github.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Subscribed X-Mailman-Version: 3.3.4 Reply-To: tohojo/flent Subject: [Flent-users] Re: [tohojo/flent] ss_iterate.sh unnecessarily runs for a long time (#236) List-Id: Flent discussion list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: ----==_mimepart_61407d9ac6853_26a5c7883751b0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Shashank D ***@***.***> writes: >> Hmm, good question. So you're just running ss in a busy loop, or did you keep the 'sleep'? If so, that seems a bit excessive to do by default. > Yes I did keep the sleep in the loop. Here's the full loop: > ```bash > command_string=$(cat < duration="$(echo "$count*$interval" | bc) sec"; > endtime=\$(date -d "\$duration" +%s%N); > while (( \$(date +%s%N) <= \$endtime )); do > ss -t -i -p -n state connected "dst $target $filter" > echo '' > date '+Time: %s.%N'; > echo "---"; > sleep $interval || exit 1; > done > EOF > ) > ``` Right, makes sense. Feel free to open a PR with this, but please lose the dependency on 'bc'. Either do the math in native shell, or just pass the duration as a parameter from Flent. Did you test whether this works on OpenWrt and on Dash? -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/tohojo/flent/issues/236#issuecomment-919035245 ----==_mimepart_61407d9ac6853_26a5c7883751b0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit

Shashank D ***@***.***> writes:

>> Hmm, good question. So you're just running ss in a busy loop, or did you keep the 'sleep'? If so, that seems a bit excessive to do by default.
> Yes I did keep the sleep in the loop. Here's the full loop:
> ```bash
> command_string=$(cat <<EOF
> duration="$(echo "$count*$interval" | bc) sec";
> endtime=\$(date -d "\$duration" +%s%N);
> while (( \$(date +%s%N) <= \$endtime )); do
> ss -t -i -p -n state connected "dst $target $filter"
> echo ''
> date '+Time: %s.%N';
> echo "---";
> sleep $interval || exit 1;
> done
> EOF
> )
> ```

Right, makes sense. Feel free to open a PR with this, but please lose
the dependency on 'bc'. Either do the math in native shell, or just pass
the duration as a parameter from Flent.

Did you test whether this works on OpenWrt and on Dash?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.

----==_mimepart_61407d9ac6853_26a5c7883751b0--