[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    Re: avoiding periodic(8) during long poudriere runs
From:       Zaphod Beeblebrox <zbeeble () gmail ! com>
Date:       2023-02-18 22:09:21
Message-ID: CACpH0MdrKQyk4fMu--6VKVtH-z4g1XqAeP8j-skZqwfB3wDQZQ () mail ! gmail ! com
[Download RAW message or body]

lockf(1) can be used at the beginning of a script:

lockf -t 60 /tmp/mylockfile /root/bin/myscript

and then when you're running poudriere,

lockf /tmp/mylockfile poudriere <other args>

On Sat, Feb 18, 2023 at 4:57 PM void <void@f-m.fm> wrote:

> On Sat, Feb 18, 2023 at 09:46:43PM +0100, Miroslav Lachman wrote:
>
> >I don't know about any generic way, but you can put some shell code into
> >/etc/periodic.conf to exit if load is too high
> >
> >Just a quick and dirty example, exit if 5 minutes avg is higher than 1.1:
> >
> >avg5load=$(top | awk '/load averages:/ { load=$7+0; if (load > 1.1) {
> >print "HIGH" } }')
> >echo $avg5load
> >if [ "$avg5load" = "HIGH" ]; then
> >         echo "CPU load is too high"
> >         exit 5
> >fi
>
> Many thanks for this. I didn't know one could put scripting into
> periodic.conf!
>
> --
>
>

[Attachment #3 (text/html)]

<div dir="ltr"><div>lockf(1) can be used at the beginning of a \
script:</div><div><br></div><div>lockf -t 60 /tmp/mylockfile \
/root/bin/myscript<br></div><div><br></div><div>and then when you&#39;re running \
poudriere,</div><div><br></div><div>lockf /tmp/mylockfile poudriere &lt;other \
args&gt;<br></div></div><br><div class="gmail_quote"><div dir="ltr" \
class="gmail_attr">On Sat, Feb 18, 2023 at 4:57 PM void &lt;<a \
href="mailto:void@f-m.fm">void@f-m.fm</a>&gt; wrote:<br></div><blockquote \
class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid \
rgb(204,204,204);padding-left:1ex">On Sat, Feb 18, 2023 at 09:46:43PM +0100, Miroslav \
Lachman wrote:<br> <br>
&gt;I don&#39;t know about any generic way, but you can put some shell code into<br>
&gt;/etc/periodic.conf to exit if load is too high<br>
&gt;<br>
&gt;Just a quick and dirty example, exit if 5 minutes avg is higher than 1.1:<br>
&gt;<br>
&gt;avg5load=$(top | awk &#39;/load averages:/ { load=$7+0; if (load &gt; 1.1) {<br>
&gt;print &quot;HIGH&quot; } }&#39;)<br>
&gt;echo $avg5load<br>
&gt;if [ &quot;$avg5load&quot; = &quot;HIGH&quot; ]; then<br>
&gt;              echo &quot;CPU load is too high&quot;<br>
&gt;              exit 5<br>
&gt;fi<br>
<br>
Many thanks for this. I didn&#39;t know one could put scripting into \
periodic.conf!<br> <br>
-- <br>
<br>
</blockquote></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic