<html><head></head><body><div class="ydp235acedayahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:16px;"><div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">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.</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Also, <span><span style="color: rgb(0, 0, 0); font-family: Helvetica Neue, Helvetica, Arial, sans-serif; font-size: 16px;">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)</span></span> - 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. </div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">If anyone knows the code/command to unload a file can you let me know.</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Thank You</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Ivan </div><div><br></div><div><br></div><div><br></div><div><br></div><div dir="ltr" data-setdir="false"><div><div dir="ltr"><br class="ydpaf22b0e5Apple-interchange-newline">Dim Email As New SmtpClient</div><div dir="ltr">Dim ftext As String</div><div dir="ltr" data-setdir="false">Dim tmp1 as String</div><div dir="ltr" data-setdir="false">Dim i as integer</div><div dir="ltr"><br></div><div dir="ltr" data-setdir="false"><div><div dir="ltr" style="color: rgb(0, 0, 0); font-family: Helvetica Neue, Helvetica, Arial, sans-serif; font-size: 16px;">Email.To.Add("<a shape="rect" href="mailto:dduck@yahoo.com" style="color: rgb(25, 106, 212); text-decoration-line: underline;" rel="nofollow" target="_blank">dduck@yahoo.com</a>")<br clear="none"></div><div><br></div></div>/do until whatever condition is meet/</div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr" data-setdir="false">< perform calculations here and write output file to email users</div><div dir="ltr"><br></div><div dir="ltr" data-setdir="false"><div><div>tmp1 = CStr(Time)</div><div>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</div><div> Print "Sleep Time...."</div><div> TextBox1.text = "Sysadmins need sleep too ...."</div><div> tmp1 = ""</div><div>Else</div></div><div><br></div></div><div dir="ltr">ftext = File.load("/media/ShortBox/Stats/pmail.txt")</div><div dir="ltr">Email.Host = "smtp.gmail.com"</div><div dir="ltr">Email.User = "<a shape="rect" href="mailto:bbunny@gmail.com" style="color: rgb(25, 106, 212); text-decoration-line: underline;" rel="nofollow" target="_blank">bbunny@gmail.com</a>"</div><div dir="ltr">Email.Password = "whatsupdoc!" </div><div dir="ltr">Email.Port = 465</div><div dir="ltr">Email.Authentication = SmtpClient.Plain<br clear="none"></div><div dir="ltr">Email.Encrypt = Net.SSL<br clear="none"></div><div dir="ltr"><br clear="none"></div><div dir="ltr">Email.From = "<a shape="rect" href="mailto:bbunny@gmail.com" style="color: rgb(25, 106, 212); text-decoration-line: underline;" rel="nofollow" target="_blank">bbunny@gmail.com</a>"</div><div dir="ltr">Email.Subject = "foghorns nephew"<br></div><div dir="ltr">Email.Body = ftext</div><div dir="ltr">Email.Add(ftext, "text/plain", "egghead jr")</div><div dir="ltr">Email.Send</div><div dir="ltr" data-setdir="false">TextBox1.Text= "Mail Sent..."<br clear="none"></div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">Endif</div></div><br></div><div class="ydp235acedasignature"><div dir="ltr" data-setdir="false"> //repeat procedure</div><p dir="ltr" data-setdir="false"><span style="font-family:garamond, new york, times, serif;"></span></p><p><span style="font-family:garamond, new york, times, serif;">Ivan \~/<br></span></p><p><span style="font-family:garamond, new york, times, serif;"></span> </p><p><span style="font-family:garamond, new york, times, serif;">I never saw a wild thing sorry for itself.</span><br style="font-family:garamond, new york, times, serif;"><span style="font-family:garamond, new york, times, serif;">A small bird will drop frozen dead from a bough</span><br style="font-family:garamond, new york, times, serif;"><span style="font-family:garamond, new york, times, serif;">Without ever having felt sorry for itself.</span><br style="font-family:garamond, new york, times, serif;"><span style="font-family:garamond, new york, times, serif;">-- D.H. Lawrence<br></span></p><p><br></p><p>http://www.usconstitution.net/const.html<br><span style="font-family:garamond, new york, times, serif;"></span></p><p><span style="font-family:garamond, new york, times, serif;">Linux - Live Free or Die.<br></span></p></div></div>
<div><br></div><div><br></div>
</div><div id="yahoo_quoted_5854686576" class="yahoo_quoted">
<div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div>
On Friday, December 6, 2019, 06:15:05 AM EST, <user-request@lists.gambas-basic.org> wrote:
</div>
<div><br></div>
<div><br></div>
<div><div dir="ltr">Send User mailing list submissions to<br></div><div dir="ltr"> <a ymailto="mailto:user@lists.gambas-basic.org" href="mailto:user@lists.gambas-basic.org">user@lists.gambas-basic.org</a><br></div><div dir="ltr"><br></div><div dir="ltr">To subscribe or unsubscribe via the World Wide Web, visit<br></div><div dir="ltr"> <a href="http://lists.gambas-basic.org/listinfo/user" target="_blank">http://lists.gambas-basic.org/listinfo/user</a><br></div><div dir="ltr">or, via email, send a message with subject or body 'help' to<br></div><div dir="ltr"> <a ymailto="mailto:user-request@lists.gambas-basic.org" href="mailto:user-request@lists.gambas-basic.org">user-request@lists.gambas-basic.org</a><br></div><div dir="ltr"><br></div><div dir="ltr">You can reach the person managing the list at<br></div><div dir="ltr"> <a ymailto="mailto:user-owner@lists.gambas-basic.org" href="mailto:user-owner@lists.gambas-basic.org">user-owner@lists.gambas-basic.org</a><br></div><div dir="ltr"><br></div><div dir="ltr">When replying, please edit your Subject line so it is more specific<br></div><div dir="ltr">than "Re: Contents of User digest..."<br></div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr">Today's Topics:<br></div><div dir="ltr"><br></div><div dir="ltr"> 1. Cascading child processes (Bruce)<br></div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr">----------------------------------------------------------------------<br></div><div dir="ltr"><br></div><div dir="ltr">Message: 1<br></div><div dir="ltr">Date: Fri, 6 Dec 2019 14:07:03 +1030<br></div><div dir="ltr">From: Bruce <<a ymailto="mailto:adamnt42@gmail.com" href="mailto:adamnt42@gmail.com">adamnt42@gmail.com</a>><br></div><div dir="ltr">To: Gambas Mailing List <<a ymailto="mailto:user@lists.gambas-basic.org" href="mailto:user@lists.gambas-basic.org">user@lists.gambas-basic.org</a>><br></div><div dir="ltr">Subject: [Gambas-user] Cascading child processes<br></div><div dir="ltr">Message-ID: <<a ymailto="mailto:a81bbd3a-f729-f358-bbf9-084897309e82@gmail.com" href="mailto:a81bbd3a-f729-f358-bbf9-084897309e82@gmail.com">a81bbd3a-f729-f358-bbf9-084897309e82@gmail.com</a>><br></div><div dir="ltr">Content-Type: text/plain; charset=utf-8; format=flowed<br></div><div dir="ltr"><br></div><div dir="ltr">(I am trying to speed up searching an increasingly large database and a <br></div><div dir="ltr">bunch of websites)<br></div><div dir="ltr"><br></div><div dir="ltr">The search program now either invokes child processes via "newproc = <br></div><div dir="ltr">Exec ..." or spawns via Shell. This is all fine and some of these <br></div><div dir="ltr">processes invoke their own set of children. Since most of them spend <br></div><div dir="ltr">most of their time waiting for an internet response or a complex SQL <br></div><div dir="ltr">query, they are mainly sleeping.<br></div><div dir="ltr"><br></div><div dir="ltr">Now occasionally, the searches take too long. So I want to terminate <br></div><div dir="ltr">them (and all their children) from the top level program, but not the <br></div><div dir="ltr">top level program ("SMain") itself.<br></div><div dir="ltr"><br></div><div dir="ltr">I have tried using Gambas process.Kill(), process.Signal(), <br></div><div dir="ltr">gb.signal.Send(blah, blah) and shelling out to the "Kill" command itself.<br></div><div dir="ltr"><br></div><div dir="ltr">None of these have been successful. All let me terminate the process <br></div><div dir="ltr">invoked by SMain but all their children are left running.<br></div><div dir="ltr"><br></div><div dir="ltr">Looking at man 2 kill it says "If pid is less than -1, then sig is sent <br></div><div dir="ltr">to every process in the process group whose ID is -pid." This does let <br></div><div dir="ltr">me send a SIGTERM to all the processes cascading from SMain, but <br></div><div dir="ltr">unfortunately sends the signal to SMain itself.<br></div><div dir="ltr"><br></div><div dir="ltr">I can't see a way to ignore or block a SIGTERM in SMain itself (and I am <br></div><div dir="ltr">not sure that I really want to).<br></div><div dir="ltr"><br></div><div dir="ltr">So, is there something that I am not seeing/understanding here or do I <br></div><div dir="ltr">need to cascade the signalling down through all these programs ( and if <br></div><div dir="ltr">so how do I trap a signal?)?<br></div><div dir="ltr"><br></div><div dir="ltr">tia<br></div><div dir="ltr">bruce<br></div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr">------------------------------<br></div><div dir="ltr"><br></div><div dir="ltr">Subject: Digest Footer<br></div><div dir="ltr"><br></div><div dir="ltr">----[ Gambas mailing-list is hosted by <a href="https://www.hostsharing.net " target="_blank">https://www.hostsharing.net </a>]----<br></div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr">------------------------------<br></div><div dir="ltr"><br></div><div dir="ltr">End of User Digest, Vol 27, Issue 22<br></div><div dir="ltr">************************************<br></div></div>
</div>
</div></body></html>