Re: avoiding periodic(8) during long poudriere runs
- In reply to: void : "Re: avoiding periodic(8) during long poudriere runs"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 18 Feb 2023 22:09:21 UTC
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!
>
> --
>
>