FAQ: Headless Image
Last updated at 9:45 am UTC on 26 January 2006
Q: How can squeak run headless?
A: (See also VM Command Line Options to start up Squeak without the main window.)
- Create a service by executing at the prompt:
c:\squeak\squeak.exe -memory: 4 -log: "C:\Squeak\vm.log" -service: "Swiki" "C:\Squeak\SwikiSqueak.image"
- For letting your image do 'something' at start up time you have different options:
- you can add a class to the StartUpList of SystemDictionary so it will get an startUp message at the service startUp. For example, if you want the PWS automatically to start up, add it to the startUpLis by executing: 'SystemDictionary addToStartUpList: PWS'.
Create the method 'startUp' at the class side of PWS with: '[PWS serveOnPort: 80 loggingTo: 'log.txt'] fork.
- Another option is:
Smalltalk snapshot: true andQuit: true.
"All your restore stuff goes here"
PWS serveOnPort: 80 loggingTo: 'log.txt'
Select all of this and DoIt. Your image will save-and-quit...IN THE
MIDDLE OF THE DOIT. When this image starts up, it continues the
DoIt, which is the restore and the PWS startup.
- Possibly a third option is giving arguments (scripts) to the image at startup. see: FAQ: Writing Scripts
- Somehow, running headless doesn't work well when your image starts up with an morphic project, so you should have saved your image in a MVC project. A possible MVC project is the project where you find the 'play with me's.
- On Windows you will likely experience problems starting if there are any spaces in your directory path. For example, placing a Squeak folder in "Documents and settings" will cause Squeak to ask for an image name (which is hard to answer in headless service mode.
I was able to answer this FAQ by collecting some work of Andreas Raab and Mark Guzdial.
Thanks, Mathieu van Echtelt