Jul 24, 2023, 8:39 AM
Post #11 of 12
(354 views)
Permalink
On Monday, 24 July 2023 15:46:07 BST Jack wrote:
> Pure guess, but the & may be getting attached to something less than the
> entire command on that line. Try enclosing the command (but not the &)
> in something. I leave it as an exercise to determine whether () or {}
> or some other closure is the right one.
Actually, the useless cat seems to have been the problem. This is running now:
# cat /usr/local/bin/emerj
#!/bin/bash
#
# Run emerge while logging the load average every 10 seconds.
#
merging=true
echo "" > /var/log/local0.log
while [ $merging ] ; do ( logger -p local0.info < /proc/loadavg; sleep 10 )
done &
/usr/bin/emerge "$@"; merging=false
I had 'tail -f /var/log/local0.log' running in another Konsole; it showed:
Jul 24 16:28:20 wstn root[13710]: 11.94 18.43 19.70 3/1419 13710
Jul 24 16:28:30 wstn root[13740]: 10.26 17.85 19.50 2/1421 13740
Jul 24 16:28:40 wstn root[13762]: 8.75 17.28 19.29 1/1423 13762
Jul 24 16:28:50 wstn root[17142]: 7.65 16.76 19.10 2/1424 17142
Jul 24 16:29:00 wstn root[20037]: 6.54 16.23 18.90 2/1428 20037
Jul 24 16:29:10 wstn root[25726]: 5.77 15.74 18.71 2/1430 25726
Jul 24 16:29:20 wstn root[2504]: 5.41 15.34 18.55 2/1427 2504
...
The last job is to parse local0.log to extract the values I want and plot
them. LibreOffice Calc might do for that.
Thanks to all for the help.
--
Regards,
Peter.