ctxlken,
Thanks for the suggestion. The problem with delaying the opening of the
browser is knowing how long to wait. If I guess wrong and it opens too
soon, the user might try to open Zope before it is ready and get an error.
The time varies a lot from machine to machine depending on the RAM and CPU
speed. What I would prefer to do is somehow determine when Zope has
completed it's startup and use that to trigger the browser opening.
Unfortunately, I haven't found a way to do that in the usual way where a
program returns a 0 when it is done. Zope isn't really finished, it is
still running. Perhaps there is a way to do this so if anyone knows what it
is or has a suggestion, please let me know.
Your suggestion made me think of another possibility. When Zope is finished
loading, it sends a message to the event log that says "INFO Zope Ready to
handle requests"
I can't find what generates that, but I am working on an alternative
solution. Overall, this is what I do.
I change the event.log in Zope.conf so it is saved in the root of c:
<eventlog>
level info
<logfile>
path c:\event.log
level info
</logfile>
</eventlog>
The script then starts zope by calling the runzope.bat file. The script
runs a loop that checks to see if the event.log exists. If it does, it
reads it into an array. Then it reads the last 5 lines of the array to see
if one of the lines contains "Zope Ready"
If it does, it starts the browser with the begin.htm file. The user can
click on the link and Zope will run.
If it doesn't, it waits 6 seconds and then checks the file again.
Here's the VB script file
OPTION EXPLICIT
Dim arrFileLines()
Dim fso, ws, file, APP_PATH, i, objFSO, objFile, l, x, filesys
'This is used to delete the old event.log so it just doesn't grow.
Unfortunately,
'I cannot get rid of it entirely.
Set filesys = CreateObject("Scripting.FileSystemObject")
filesys.CreateTextFile "c:\event.log", True
If filesys.FileExists("c:\event.log") Then
filesys.DeleteFile "c:\event.log"
End If
x=0
Set ws = WScript.CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
APP_PATH="""\Zope\Instance\2.9.8\bin\runzope.bat"""
ws.run APP_PATH
'WScript.sleep 60000
i = 0
While x = 0
'zope.conf must point the event log to c:\event.log. This writes the file
on the user's hard drive
'since the cd is R/O It's deleted in the beginning, but will remain when
the user quits.
If objFSO.FileExists("c:\event.log") then
Set objFile = objFSO.OpenTextFile("c:\event.log", 1)
i=0
Do Until objFile.AtEndOfStream
Redim Preserve arrFileLines(i)
arrFileLines(i) = objFile.ReadLine
i = i + 1
Loop
If i > 5 then 'the file was at least 5 lines long when it was
read.
objFile.Close
'read the last five lines in the event.log file
For l = Ubound(arrFileLines)-5 to Ubound(arrFileLines)
if InStr(arrFileLines(l),"Zope Ready") > 0 then 'Zope is
ready to run
'Zope Ready is in the log. Zope has finished loading
APP_PATH = """\begin.htm"""
'Open the browser for the user to link to Zope/Plone
ws.run APP_PATH
x = 1
else
WScript.sleep 6000 ' Zope is starting, but hasn't
finished. Wait 6 seconds and read again.
end if
Next
else
WScript.sleep 6000 'Eventlog was not long enough to read.
Wait 6 seconds and read again.
end if
end if
WEnd
'Close the output file
objFSO.close
I have to leave Zope in read/write mode or it won't write the "Zope Ready"
line.
This means I can't set
zserver-read-only-mode on
read-only-database on
as was suggested in the tutorial.
It does generate this error several times in the event.log, but it doesn't
seem to cause a problem.
File "C:\Zope\2.9.8\Zope\lib\python\ZODB\BaseStorage.py", line 150, in
new_oid
raise POSException.ReadOnlyError()
ReadOnlyError
As I said earlier, I wish I knew how to determine Zope was running without
reading the event.log or maybe redirect the event.log to something I could
read, but I can't find where the message "Zope Ready..." is generated. I
searched all the files and it doesn't show up anywhere I see.
Thanks for you help. This will have to do for now.
--
View this message in context:
http://plone.293351.n2.nabble.com/Run-Plone-off-cd-rom-tp4992228p5027845.html
Sent from the Installation, Setup, Upgrades mailing list archive at Nabble.com.
_______________________________________________
Setup mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/setup