[Gambas-user] User Digest, Vol 27, Issue 22

Ivan Williams ivanwms64 at yahoo.com
Fri Dec 6 15:35:14 CET 2019


This is a addendum to my email yesterday - if you are using the mail function inside of a procedure with a loop - put the email.to.add outside of the loop else it will stack on the emails and you will receive multiple copies of the same email.
Also, ftext = File.load("/media/ShortBox/Stats/pmail.txt")   does not unload the previous file so it is adding all the files to the email as the program executes (luckily it only executes every 30 minutes)    -  I am currently looking for a way to unload the ftext once it has been loaded.   ftext="" does not work and file.unload does not exist.   
If anyone knows the code/command to unload a file can you let me know.
Thank You
Ivan 




Dim Email As New SmtpClientDim ftext As StringDim tmp1 as StringDim i as integer
Email.To.Add("dduck at yahoo.com")

/do until whatever condition is meet/

< perform calculations here and write output file to email users
tmp1 = CStr(Time)If Mid$(tmp1, 1, 2) = "02" Or Mid$(tmp1, 1, 2) = "03" Or Mid$(tmp1, 1, 2) = "04" Or Mid$(tmp1, 1, 2) = "05" Then    Print "Sleep Time...."    TextBox1.text = "Sysadmins need sleep too ...."    tmp1 = ""Else
ftext = File.load("/media/ShortBox/Stats/pmail.txt")Email.Host = "smtp.gmail.com"Email.User = "bbunny at gmail.com"Email.Password = "whatsupdoc!" Email.Port = 465Email.Authentication = SmtpClient.Plain
Email.Encrypt = Net.SSL

Email.From = "bbunny at gmail.com"Email.Subject = "foghorns nephew"
Email.Body = ftextEmail.Add(ftext, "text/plain", "egghead jr")Email.SendTextBox1.Text= "Mail Sent..."

Endif
 //repeat procedure


Ivan    \~/


 

I never saw a wild thing sorry for itself.
A small bird will drop frozen dead from a bough
Without ever having felt sorry for itself.
-- D.H. Lawrence





http://www.usconstitution.net/const.html


Linux - Live Free or Die.

 

    On Friday, December 6, 2019, 06:15:05 AM EST, <user-request at lists.gambas-basic.org> wrote:  
 
 Send User mailing list submissions to
    user at lists.gambas-basic.org

To subscribe or unsubscribe via the World Wide Web, visit
    http://lists.gambas-basic.org/listinfo/user
or, via email, send a message with subject or body 'help' to
    user-request at lists.gambas-basic.org

You can reach the person managing the list at
    user-owner at lists.gambas-basic.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of User digest..."


Today's Topics:

  1. Cascading child processes (Bruce)


----------------------------------------------------------------------

Message: 1
Date: Fri, 6 Dec 2019 14:07:03 +1030
From: Bruce <adamnt42 at gmail.com>
To: Gambas Mailing List <user at lists.gambas-basic.org>
Subject: [Gambas-user] Cascading child processes
Message-ID: <a81bbd3a-f729-f358-bbf9-084897309e82 at gmail.com>
Content-Type: text/plain; charset=utf-8; format=flowed

(I am trying to speed up searching an increasingly large database and a 
bunch of websites)

The search program now either invokes child processes via "newproc = 
Exec ..." or spawns via Shell. This is all fine and some of these 
processes invoke their own set of children. Since most of them spend 
most of their time waiting for an internet response or a complex SQL 
query, they are mainly sleeping.

Now occasionally, the searches take too long. So I want to terminate 
them (and all their children) from the top level program,  but not the 
top level program ("SMain") itself.

I have tried using Gambas process.Kill(), process.Signal(), 
gb.signal.Send(blah, blah) and shelling out to the "Kill" command itself.

None of these have been successful. All let me terminate the process 
invoked by SMain but all their children are left running.

Looking at man 2 kill it says "If pid is less than -1, then sig is sent 
to every process in the process group whose ID is -pid." This does let 
me send a SIGTERM to all the processes cascading from SMain, but 
unfortunately sends the signal to SMain itself.

I can't see a way to ignore or block a SIGTERM in SMain itself (and I am 
not sure that I really want to).

So, is there something that I am not seeing/understanding here or do I 
need to cascade the signalling down through all these programs ( and if 
so how do I trap a signal?)?

tia
bruce




------------------------------

Subject: Digest Footer

----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----


------------------------------

End of User Digest, Vol 27, Issue 22
************************************
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20191206/fe5cf735/attachment-0001.html>


More information about the User mailing list