TIP: Click on subject to list as thread! ANSI
echo: os2rexx
to: Francois Massonneau
from: David Noon
date: 1999-11-25 22:49:25
subject: FrontDoor/Mailer and Re

Hi Francois,

Replying to a message of Francois Massonneau to David Noon:

 FM> As I do not know whether or not the first message I posted has been
 FM> sent (France is no longer connected to the rest of the world ;-( ), i
 FM> post it again as I found another feed. I hope I will be sent this
 FM> time.

I saw your earlier message last month and replied.

 DN>> This means it will terminate after one poll. Also, the conditional
 DN>> leave statement (mentioned above for its IF part) will need to be
 DN>> changed to:

 DN>>      if files.0 = 0 then
 DN>>          exit 0 /* was leave */

 FM> I did that, but it doesn't work as expected.
 FM> If I put "exit 0", when no more files are in the subdirectory, the
 FM> window is closed, but the windows that launched the script and the
 FM> one where the dialer is running are still opened and wait for the
 FM> signal the script must send to tell everything is done. so I left the
 FM> "leave" statement.

This should cause the REXX program to terminate in error. The LEAVE statement
applies to the context of a DO group, and removing the DO FOREVER removes that 
context.

 FM>> And finally I removed those lines :
 FM>>  call SysSleep SleepTime
 FM>>  call stream SemaMailer, 'c', 'open write'
 FM>>  call lineout SemaMailer, 'inetmail semafore file'
 FM>>  call stream SemaMailer, 'c', 'close'

 DN>> So you are no longer using a semphore file.

 FM> It's no longer a semafore file, but the script sends a signal to
 FM> HWAIT.

What kind of signal? Does it post an event semaphore (not a file) instead?

 FM>> 3) At the end of the script, I saw you write two times (one before
 FM>> and one after the subroutine "StopDialler"), the following lines : 
 FM>> /* Reset elapsed time counter */  CALL TIME 'R' RETURN I suppose one
 FM>> is for the subroutine StartDialler, and the second one is for the
 FM>> subroutine StopDialler. Is it a code to give the time on line ?

 DN>> It is part of that code.

 DN>> There should be a TIME('E') call somewhere in the StopDialler
 DN>> subroutine that should display the elapsed time.

 FM> Where ?

Down below ...

 FM> May I put at the beginning :
 FM> CALL TIME('E')
 FM> for example, just after the "CALL DIRECTORY DialerDir" statement and
 FM> before the "ADDRESS 'CMD' KillDialer" line ? This is the subroutine
 FM> you wrote :
 FM> /* Subroutine to stop the dialer program and its related address spaces
*/ 
 FM> StopDialer: PROCEDURE EXPOSE DialupLogFile DialerDir KillDialer kill
inetmail pop3d smtpd
 FM>   CurDir = DIRECTORY()  
 FM>   CALL DIRECTORY DialerDir

 FM>   ADDRESS 'CMD' KillDialer
 FM>   CALL LogMsg 'dialer, if running, is killed.'
 FM>   CALL LogMsg 'Dialer disconnected after ' || TIME('E') || ' seconds.'

... right here! (Above)

 FM>   CALL DIRECTORY CurDir

 FM>   ADDRESS 'CMD' kill inetmail
 FM>   CALL LogMsg 'inetmail, if running, is killed.'

 FM>   ADDRESS 'CMD' kill pop3d
 FM>   CALL LogMsg 'pop3d process, if running, is killed.'

 FM>   ADDRESS 'CMD' kill smtpd
 FM>   CALL LogMsg 'smtpd process, if running, is killed.'

 FM>   CALL SysSleep 2    /* just give it a little time to shut down... */

 FM>   /* Reset elapsed time counter */
 FM>   CALL TIME 'R'
 FM> RETURN

 FM>> If so, where in the log file do I find it ??

 FM>> 22 Oct 1999 08:32:54  Dialler disconnected after 0 seconds.

 DN>> Here. For some reason the elapsed timer has been reset again, giving
 DN>> a time of zero seconds.

 FM>> So the time on line is not 0 second, but about 8 minutes.

 DN>> That would be about 480 seconds then. That is what should have been
 DN>> returned by the TIME('E') call. Since there are 2 calls to
 DN>> StopDialler, the second one should have the correct elapsed time
 DN>> logged.

 FM> OK.
 FM> Is it possible to add something to the routine to give the cost of the
 FM> call. One parameter could be the cost for one minute on line
 FM> "CostperMinute", and at the end of each run, the log could record the
 FM> total time on line, and the resulting cost ?

If you know the cost per second (or minute) then you can use the result
returned by the TIME('E') call to calculate the  cost of the call. It should
be simple multiplication.

 FM> I saw a problem with the log generated.
 FM> A file is created in my root directory, named DIALUPLOGFILE. In it I
 FM> have all the sentences that should be put in the dialup.log file, but
 FM> the sentences are the ones generated by the PingServer Procedure. It
 FM> seems that a "CALL LogMsg ..." statement contained in the PingServer
 FM> procedure is not written in the dialup.log file, but in a
 FM> dialuplogfile file in my root directory. Is it because I have the
 FM> beginning of the procedure written that way : 
 FM> PingServer: procedure  
 FM> call LogMsg 'PingServer starting'
 FM>   .../. instead of :
 FM> PingServer:
 FM> PROCEDURE EXPOSE DialupLogFile   
 FM> call LogMsg 'PingServer starting'  
 FM> .../.

It could be. I no longer have your code. If the variable DialpuLogFile
contains the full path/filename of your log file then the PingServer
subroutine will need to access it in order to write its results to the correct 
log file. In such a case you should either pass it as a parameter or expose it 
on the PROCEDURE statement.

Regards

Dave


--- FleetStreet 1.24.1
* Origin: (2:257/609.5)

SOURCE: echoes via The OS/2 BBS

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.