• Re: BASH Script MkII

    From tenser@21:1/188 to Spectre on Saturday, January 18, 2020 07:14:10
    On 18 Jan 2020, Spectre said the following...

    Soooo do I leave it at approx 6 and watch the intermittant spikes come and go? Do I got for 8 or more after it exceeds an effective load
    average of one, or do I place it perhaps as high as 10-15 and just catch the really weird stuff that is still occasionally getting installed?

    I've presently set it for greater than 7, but thoughts would be appreciated.

    I think it's all about personal preference: how much email do
    you want to receive?

    --- Mystic BBS v1.12 A43 2019/03/03 (Raspberry Pi/32)
    * Origin: ACiD Underworld // acidunderworld.com:31337 (21:1/188)
  • From Spectre@21:3/101 to Tenser on Saturday, January 18, 2020 18:41:00
    echo "SABRETOOTH! Your Server Load Alert Needs Attention! \n $(cat /proc/loadavg) " | mail -s "System Load Alert" spectre@tlp.zapto.org


    Can you tell me why neither of these produce a new line at \n? Ahh my bad, I found an answer to this one, with a -e on the echo.

    However... my next concern is at what load average to send the warning at. Now that the email contains the actual load average, I can safely set it lower, but the thing is really just idling, its an 8 core processor so its load avg is effectively under 1 all the time. It seems to spike as high as 7 intermittantly.. and normally between 5-6. Haven't gotten to the bottom of why
    it spikes yet. Oddly enough the xscreen saver seems to be part of the problem.
    And of course if I have rogue installations in the BBS user it pops straight out to 20...

    Soooo do I leave it at approx 6 and watch the intermittant spikes come and go? Do I got for 8 or more after it exceeds an effective load average of one, or do I place it perhaps as high as 10-15 and just catch the really weird stuff that is still occasionally getting installed?

    I've presently set it for greater than 7, but thoughts would be appreciated.

    Spec


    --- SuperBBS v1.17-3 (Eval)
    * Origin: (21:3/101)
  • From Spectre@21:3/101 to Tenser on Saturday, January 18, 2020 18:41:00
    echo "SABRETOOTH! Your Server Load Alert Needs Attention! \n $(cat /proc/loadavg) " | mail -s "System Load Alert" spectre@tlp.zapto.org


    Can you tell me why neither of these produce a new line at \n? Ahh my bad, I
    found an answer to this one, with a -e on the echo.

    However... my next concern is at what load average to send the warning at. Now that the email contains the actual load average, I can safely set it lower,
    but the thing is really just idling, its an 8 core processor so its load avg is effectively under 1 all the time. It seems to spike as high as 7 intermittantly.. and normally between 5-6. Haven't gotten to the bottom of why it spikes yet. Oddly enough the xscreen saver seems to be part of the problem. And of course if I have rogue installations in the BBS user it pops straight out to 20...

    Soooo do I leave it at approx 6 and watch the intermittant spikes come and go?
    Do I got for 8 or more after it exceeds an effective load average of one, or do I place it perhaps as high as 10-15 and just catch the really weird stuff that is still occasionally getting installed?

    I've presently set it for greater than 7, but thoughts would be appreciated.

    Spec


    --- SuperBBS v1.17-3 (Eval)
    * Origin: (21:3/101)
  • From Spectre@21:3/101 to tenser on Sunday, January 19, 2020 08:26:00
    I think it's all about personal preference: how much email do you
    want to receive?

    As it turns out not a lot, and want it to be somewhat meaningful, having let it run overnight, I find I have some 36 instances of > 7 and the peak was 9.x sooo I think I'm going to set it to > 10 and see what happens.

    Whatever peaks the load, seems to happen about once an hour at the half hour, not always consistent though. It generally seems to reach 8 with the odd 9.x thrown in there.

    Spec


    *** THE READER V4.50 [freeware]
    --- SuperBBS v1.17-3 (Eval)
    * Origin: Scrawled in haste at The Lower Planes (21:3/101)
  • From tenser@21:1/188 to Spectre on Saturday, January 18, 2020 20:06:11
    On 19 Jan 2020, Spectre said the following...

    I think it's all about personal preference: how much email do you want to receive?

    As it turns out not a lot, and want it to be somewhat meaningful, having let it run overnight, I find I have some 36 instances of > 7 and the
    peak was 9.x sooo I think I'm going to set it to > 10 and see what happens.

    Whatever peaks the load, seems to happen about once an hour at the half hour, not always consistent though. It generally seems to reach 8 with
    the odd 9.x thrown in there.

    So you might consider making your script email you the output of `top`
    when the load gets high. It sounds like you've got some job that's
    running every half hour or so that's driving the load up.

    --- Mystic BBS v1.12 A43 2019/03/03 (Raspberry Pi/32)
    * Origin: ACiD Underworld // acidunderworld.com:31337 (21:1/188)
  • From Spectre@21:3/101 to tenser on Sunday, January 19, 2020 15:41:00
    So you might consider making your script email you the output of `top`

    You're going to make me read the man page aren't you....I've only ever used top
    in an interactive fashion :)

    Spec


    *** THE READER V4.50 [freeware]
    --- SuperBBS v1.17-3 (Eval)
    * Origin: Scrawled in haste at The Lower Planes (21:3/101)
  • From tenser@21:1/188 to Spectre on Sunday, January 19, 2020 11:51:40
    On 19 Jan 2020, Spectre said the following...

    So you might consider making your script email you the output of `top

    You're going to make me read the man page aren't you....I've only ever used top in an interactive fashion :)

    Heh. Actually, on Linux, `top` may not be what you want. It appears to
    ONLY support an interactive mode (complete with all the terminal-handling metacharacters in its output). On BSD, if you pipe the output of top
    into a program, it does one interation and omits the terminal stuff, so
    you can pipe it into `mail` or something.

    However, on Linux, you can run `ps` in a way that will show you the top consumers of CPU time:

    ps -Ao user,uid,comm,pid,pcpu --sort=-pcpu | head -20

    If you decide that you want to include that in an email, you can
    include some explanatory text via something like:

    load=$(awk '{print $1}' /proc/loadavg)
    if [ $(expr $load '>' 8) -eq 1 ]; then
    (echo "Load average exceeds threshold: $load";
    ps -Ao user,uid,comm,pid,pcpu --sort=-pcpu | head -20) |
    mail -s "Load average alert" user@where.ever
    fi

    Note the '()' around `echo` and `ps`; this invokes them in a subshell.
    The output of the entire subshell is then piped to `mail`.

    --- Mystic BBS v1.12 A43 2019/03/03 (Raspberry Pi/32)
    * Origin: ACiD Underworld // acidunderworld.com:31337 (21:1/188)
  • From Spectre@21:3/101 to tenser on Sunday, January 19, 2020 20:38:00
    I've presently set it for greater than 7, but thoughts would be appreciated.

    I think it's all about personal preference: how much email do you
    want to receive?

    Good call on top, never looked at it for that purpose before. Looks like the suspect screen saver is probably the culprit, m6502. Its been modified for screen blanking only we'll see what happens.

    Spec


    *** THE READER V4.50 [freeware]
    --- SuperBBS v1.17-3 (Eval)
    * Origin: Scrawled in haste at The Lower Planes (21:3/101)
  • From Spectre@21:3/101 to tenser on Monday, January 20, 2020 06:05:00
    So you might consider making your script email you the output of `top

    You're going to make me read the man page aren't you....I've
    only ever used top in an interactive fashion :)

    Heh. Actually, on Linux, `top` may not be what you want. It appears
    to ONLY support an interactive mode (complete with all the

    And the winner is... top -b -n1 for just 1 iteration.. :)

    Spec


    --- SuperBBS v1.17-3 (Eval)
    * Origin: < Scrawled in blood at The Lower Planes > (21:3/101)
  • From tenser@21:1/188 to Spectre on Sunday, January 19, 2020 15:36:41
    On 20 Jan 2020, Spectre said the following...

    Heh. Actually, on Linux, `top` may not be what you want. It appears to ONLY support an interactive mode (complete with all the

    And the winner is... top -b -n1 for just 1 iteration.. :)

    Ah great! Yeah, that sounds like precisely what you want.

    --- Mystic BBS v1.12 A43 2019/03/03 (Raspberry Pi/32)
    * Origin: ACiD Underworld // acidunderworld.com:31337 (21:1/188)
  • From StackFault@21:1/172 to tenser on Monday, January 20, 2020 00:24:40
    Heh. Actually, on Linux, `top` may not be what you want. It appears to ONLY support an interactive mode (complete with all the terminal-handling

    You could use 'top -b -n1', it may not be supported on all platforms but most Linux distro should allow it.

    Cheers!

    |15 |15StackFault |08<|03.|11.|15P|11h|03EN|11o|15M|11.|03.|08>
    |11 |11The Bottomless Abyss BBS
    |03 |03ssh|08.|072222 |08/ |03telnet|08.|072023 |08/ |03https
    |08 |08bbs|07.|08bottomlessabyss|07.|08net

    --- Mystic BBS v1.12 A43 2019/03/02 (Linux/64)
    * Origin: The Bottomless Abyss BBS * bbs.bottomlessabyss.net (21:1/172)
  • From StackFault@21:1/172 to Spectre on Monday, January 20, 2020 00:25:53
    And the winner is... top -b -n1 for just 1 iteration.. :)

    Spec

    I should start reading backwards :)

    |15 |15StackFault |08<|03.|11.|15P|11h|03EN|11o|15M|11.|03.|08>
    |11 |11The Bottomless Abyss BBS
    |03 |03ssh|08.|072222 |08/ |03telnet|08.|072023 |08/ |03https
    |08 |08bbs|07.|08bottomlessabyss|07.|08net

    --- Mystic BBS v1.12 A43 2019/03/02 (Linux/64)
    * Origin: The Bottomless Abyss BBS * bbs.bottomlessabyss.net (21:1/172)
  • From Spectre@21:3/101 to StackFault on Tuesday, January 21, 2020 09:15:00
    You could use 'top -b -n1', it may not be supported on all platforms but most Linux distro should allow it.

    SNAP! :)

    Spec


    *** THE READER V4.50 [freeware]
    --- SuperBBS v1.17-3 (Eval)
    * Origin: Scrawled in haste at The Lower Planes (21:3/101)
  • From Spectre@21:3/101 to StackFault on Tuesday, January 21, 2020 09:19:00
    I should start reading backwards :)

    It feels like that at times doesn't it. In dem good ol' days I used to read all
    smaller boards and TLP backwards, until you got tired of reading... if you're on top of the message reading it works well. But in these days of using "The Reader" or whatever else you're using it seems a lot easier to keep reading it forwards.

    Spec


    *** THE READER V4.50 [freeware]
    --- SuperBBS v1.17-3 (Eval)
    * Origin: Scrawled in haste at The Lower Planes (21:3/101)
  • From MeaTLoTioN@21:1/158 to All on Tuesday, January 21, 2020 15:35:33
    On Mon, 20 Jan 2020 06:05:00 GMT
    Spectre wrote:

    So you might consider making your script email you the output of
    `top

    You're going to make me read the man page aren't you....I've
    only ever used top in an interactive fashion :)

    Heh. Actually, on Linux, `top` may not be what you want. It
    appears to ONLY support an interactive mode (complete with all
    the

    And the winner is... top -b -n1 for just 1 iteration.. :)

    Spec


    --- SuperBBS v1.17-3 (Eval)
    * Origin: < Scrawled in blood at The Lower Planes > (21:3/101)

    You could use `ps` like this;

    ps axo pid,%cpu,cmd --sort=%cpu | tail -5 | tac


    What does this do?
    "ps axo pid,%cpu,cmd --sort=%cpu" just lists all running processes
    displaying just the PID, the %CPU usage and the command itself
    "| tail -5" takes the output of the above and shows just the last 5
    lines of it - anything more would likely be too much...
    "| tac" takes the output of the above and reverses it.

    This will produce a list of the top 5 processes using the cpu, with the
    highest at the top in a descending order.

    Hope this helps =)


    --
    Best regards,
    MeaTLoTioN

    --- Mystic BBS/NNTP v1.12 A43 2019/03/02 (Linux/64)
    * Origin: The Quantum Wormhole, Ramsgate, UK. bbs.erb.pw (21:1/158)
  • From Alterego@21:2/116 to MeaTLoTioN on Wednesday, January 22, 2020 09:26:36
    Re: Re: BASH Script MkII
    By: MeaTLoTioN to All on Tue Jan 21 2020 03:35 pm

    ps axo pid,%cpu,cmd --sort=%cpu | tail -5 | tac

    So I've been using unix for a looooong time - and every now and again, I learn of a new command - "tac", never knew about that one... :)
    ...deon


    ... Bend the facts to fit the conclusion. It's easier that way.
    --- SBBSecho 3.10-Linux
    * Origin: I'm playing with ANSI+videotex - wanna play too? (21:2/116)
  • From tenser@21:1/188 to MeaTLoTioN on Tuesday, January 21, 2020 21:22:17
    On 21 Jan 2020, MeaTLoTioN said the following...

    You could use `ps` like this;

    ps axo pid,%cpu,cmd --sort=%cpu | tail -5 | tac


    What does this do?
    "ps axo pid,%cpu,cmd --sort=%cpu" just lists all running processes displaying just the PID, the %CPU usage and the command itself
    "| tail -5" takes the output of the above and shows just the last 5
    lines of it - anything more would likely be too much...
    "| tac" takes the output of the above and reverses it.

    This will produce a list of the top 5 processes using the cpu, with the highest at the top in a descending order.

    Using `tac` is a clever trick, but if you prepend a '-' to the sort
    character, it'll reverse the sort order so that processes are listed
    in descending order. Then you can use `head` (or the more authentic
    `sed 10q` and also have the header).

    --- Mystic BBS v1.12 A43 2019/03/03 (Raspberry Pi/32)
    * Origin: ACiD Underworld // acidunderworld.com:31337 (21:1/188)
  • From MeaTLoTioN@21:1/158 to Alterego on Wednesday, January 22, 2020 13:29:27
    So I've been using unix for a looooong time - and every now and again, I learn of a new command - "tac", never knew about that one... :)
    ...deon

    Ahhh well, glad I was able to teach you something new =) every day is a learning day IMHO.

    Today I am learning how to build a new node in an OpenNebula cluster.
    Lots of fun and learning. =)

    ---
    |14Best regards,
    |11Ch|03rist|11ia|15n |11a|03ka |11Me|03aTLoT|11io|15N

    |07 |08[|10eml|08] |15ml@erb.pw |07 |08[|10web|08] |15www.erb.pw |07Ŀ |07 |08[|09fsx|08] |1521:1/158 |07 |08[|11tqw|08] |151337:1/101 |07 |07 |08[|12rtn|08] |1580:774/81 |07 |08[|14fdn|08] |152:250/5 |07
    |07 |08[|10ark|08] |1510:104/2 |07

    --- Mystic BBS v1.12 A43 2019/03/02 (Linux/64)
    * Origin: The Quantum Wormhole, Ramsgate, UK. bbs.erb.pw (21:1/158)
  • From MeaTLoTioN@21:1/158 to tenser on Wednesday, January 22, 2020 13:31:08
    Using `tac` is a clever trick, but if you prepend a '-' to the sort character, it'll reverse the sort order so that processes are listed
    in descending order. Then you can use `head` (or the more authentic
    `sed 10q` and also have the header).

    This is true, but I wanted it without the header so leaving it ascending and then grab the last 5 and then reversing them saved a whole bunch of sed/awk/jiggery-pokery imo.

    ---
    |14Best regards,
    |11Ch|03rist|11ia|15n |11a|03ka |11Me|03aTLoT|11io|15N

    |07 |08[|10eml|08] |15ml@erb.pw |07 |08[|10web|08] |15www.erb.pw |07Ŀ |07 |08[|09fsx|08] |1521:1/158 |07 |08[|11tqw|08] |151337:1/101 |07 |07 |08[|12rtn|08] |1580:774/81 |07 |08[|14fdn|08] |152:250/5 |07
    |07 |08[|10ark|08] |1510:104/2 |07

    --- Mystic BBS v1.12 A43 2019/03/02 (Linux/64)
    * Origin: The Quantum Wormhole, Ramsgate, UK. bbs.erb.pw (21:1/158)
  • From Alterego@21:2/116 to MeaTLoTioN on Thursday, January 23, 2020 08:52:06
    Re: Re: BASH Script MkII
    By: MeaTLoTioN to Alterego on Wed Jan 22 2020 01:29 pm

    Today I am learning how to build a new node in an OpenNebula cluster.
    Lots of fun and learning. =)

    I've heard of OpenNebula - not exactly sure what it does. I know of it because I get spam every now and again.

    I'm playing with ansible and OpenShift... My goal is to deploy VMs with ansible, and then automate the install of Openshift in those VMs. (I want to automate it, so when it expires in 60 days, I can rebuild it...)

    Hopefully achieving above I'll learn more about both products...
    ...deon


    ... A feature is a bug with seniority.
    --- SBBSecho 3.10-Linux
    * Origin: I'm playing with ANSI+videotex - wanna play too? (21:2/116)
  • From Spectre@21:3/101 to MeaTLoTioN on Thursday, January 23, 2020 09:37:00
    This is true, but I wanted it without the header so leaving it ascending and then grab the last 5 and then reversing them saved a whole bunch
    of sed/awk/jiggery-pokery imo.

    Chuckle, if you take them in the correct order from the start, you can just feed it through tail. The length of the top output is fixed, just tail 20 I think it is off hand and you've got all the results. I actually ended up using tail to remove the header, and then head to limit the result to top 10 :)

    Spec


    *** THE READER V4.50 [freeware]
    --- SuperBBS v1.17-3 (Eval)
    * Origin: Scrawled in haste at The Lower Planes (21:3/101)
  • From MeaTLoTioN@21:1/158 to Alterego on Thursday, January 23, 2020 21:11:04
    I've heard of OpenNebula - not exactly sure what it does. I know of it because I get spam every now and again.

    OpenNebula is another hypervisor platform like proxmox, opensource. It looks pretty nice, but it's not as easy to do stuff in, but it seems to be more powerful too.

    I'm playing with ansible and OpenShift... My goal is to deploy VMs with ansible, and then automate the install of Openshift in those VMs. (I
    want to automate it, so when it expires in 60 days, I can rebuild it...)

    That sounds like fun, I haven't really done anything in ansible myself much
    yet but I use it at work running a bunch of playbooks that someone else made
    to build our systems. It's pretty nice.

    Hopefully achieving above I'll learn more about both products...
    ...deon

    I'm sure you will, I love learning.

    ---
    |14Best regards,
    |11Ch|03rist|11ia|15n |11a|03ka |11Me|03aTLoT|11io|15N

    |07 |08[|10eml|08] |15ml@erb.pw |07 |08[|10web|08] |15www.erb.pw |07Ŀ |07 |08[|09fsx|08] |1521:1/158 |07 |08[|11tqw|08] |151337:1/101 |07 |07 |08[|12rtn|08] |1580:774/81 |07 |08[|14fdn|08] |152:250/5 |07
    |07 |08[|10ark|08] |1510:104/2 |07

    --- Mystic BBS v1.12 A43 2019/03/02 (Linux/64)
    * Origin: The Quantum Wormhole, Ramsgate, UK. bbs.erb.pw (21:1/158)
  • From MeaTLoTioN@21:1/158 to Spectre on Thursday, January 23, 2020 21:12:58
    Chuckle, if you take them in the correct order from the start, you can just feed it through tail. The length of the top output is fixed, just tail 20 I think it is off hand and you've got all the results. I
    actually ended up using tail to remove the header, and then head to
    limit the result to top 10 :)

    Nice, yeah my method isn't necessarily elegant or the most efficient but it
    did what I needed it to. I love learning how other people approach the same problems and see how they overcome them.

    ---
    |14Best regards,
    |11Ch|03rist|11ia|15n |11a|03ka |11Me|03aTLoT|11io|15N

    |07 |08[|10eml|08] |15ml@erb.pw |07 |08[|10web|08] |15www.erb.pw |07Ŀ |07 |08[|09fsx|08] |1521:1/158 |07 |08[|11tqw|08] |151337:1/101 |07 |07 |08[|12rtn|08] |1580:774/81 |07 |08[|14fdn|08] |152:250/5 |07
    |07 |08[|10ark|08] |1510:104/2 |07

    --- Mystic BBS v1.12 A43 2019/03/02 (Linux/64)
    * Origin: The Quantum Wormhole, Ramsgate, UK. bbs.erb.pw (21:1/158)
  • From Spectre@21:3/101 to MeaTLoTioN on Friday, January 24, 2020 13:02:00
    Nice, yeah my method isn't necessarily elegant or the most efficient
    but it did what I needed it to. I love learning how other people
    approach the same problems and see how they overcome them.

    The most important part is it works :) 98% functionality, 2% anything else

    Spec


    --- SuperBBS v1.17-3 (Eval)
    * Origin: < Scrawled in blood at The Lower Planes > (21:3/101)
  • From MeaTLoTioN@21:1/158 to Spectre on Friday, January 24, 2020 19:03:42
    The most important part is it works :) 98% functionality, 2% anything else

    Right on!!

    ---
    |14Best regards,
    |11Ch|03rist|11ia|15n |11a|03ka |11Me|03aTLoT|11io|15N

    |07 |08[|10eml|08] |15ml@erb.pw |07 |08[|10web|08] |15www.erb.pw |07Ŀ |07 |08[|09fsx|08] |1521:1/158 |07 |08[|11tqw|08] |151337:1/101 |07 |07 |08[|12rtn|08] |1580:774/81 |07 |08[|14fdn|08] |152:250/5 |07
    |07 |08[|10ark|08] |1510:104/2 |07

    --- Mystic BBS v1.12 A43 2019/03/02 (Linux/64)
    * Origin: The Quantum Wormhole, Ramsgate, UK. bbs.erb.pw (21:1/158)