I found the following example of using the -headless command-line option related to Swiki. --- squeak -headless squeak.image config.st The Configuration File config.st looks something like this: ComSwikiLauncher allInstances do: [ :instance | instance port: 8000. instance isOn ifTrue: [ instance stopServer ]. instance startServer. ].! --- Why does the last line end in ".!"? I've been struggling for weeks to get anything to work with -headless on both Mac OS X and Windows. Based on the lack of replies to my questions on this it seems fair to conclude that this feature isn't used by most Squeak developers. Is that the case? I'd love to see a simple example of a .st file that can be used with - headless. More than anything I'd love to get some confirmation that - headless actually works for somebody. --- Mark Volkmann
On Sun, Oct 19, 2008 at 02:06:29PM -0500, Mark Volkmann wrote:
I found the following example of using the -headless command-line option related to Swiki.
squeak -headless squeak.image config.st The Configuration File config.st looks something like this: ComSwikiLauncher allInstances do: [ :instance | instance port: 8000. instance isOn ifTrue: [ instance stopServer ]. instance startServer. ].!
Why does the last line end in ".!"?
The "!" character is a delimiter for a "chunk" of code in the traditional Smalltalk "fileout" format (http://wiki.squeak.org/squeak/1105). It is probably not necessary in this script, but harmless.
The period is a statement terminator, definitely not required in the above script, but also harmless.
I've been struggling for weeks to get anything to work with -headless on both Mac OS X and Windows. Based on the lack of replies to my questions on this it seems fair to conclude that this feature isn't used by most Squeak developers. Is that the case? I'd love to see a simple example of a .st file that can be used with - headless. More than anything I'd love to get some confirmation that - headless actually works for somebody.
The "-headless" option definitely works for the unix VM. I don't know about OS X or Windows.
If you are trying to get a start script working, start by getting it to work with the normal Squeak UI. After you have this working, add the "-headless" option to make the UI go away.
If you are having trouble getting the script file to run, try using a fully qualified path name:
$ squeak myimage.image /path/to/my/script.st
IIRC, some versions of the VM may require syntax like this:
$ squeak myimage.image file:///path/to/my/script.st
HTH, Dave
On Oct 22, 2008, at 10:47 PM, David T. Lewis wrote:
On Sun, Oct 19, 2008 at 02:06:29PM -0500, Mark Volkmann wrote:
I've been struggling for weeks to get anything to work with -headless on both Mac OS X and Windows. Based on the lack of replies to my questions on this it seems fair to conclude that this feature isn't used by most Squeak developers. Is that the case? I'd love to see a simple example of a .st file that can be used with - headless. More than anything I'd love to get some confirmation that - headless actually works for somebody.
The "-headless" option definitely works for the unix VM. I don't know about OS X or Windows.
If you are trying to get a start script working, start by getting it to work with the normal Squeak UI. After you have this working, add the "-headless" option to make the UI go away.
If you are having trouble getting the script file to run, try using a fully qualified path name:
$ squeak myimage.image /path/to/my/script.st
Thanks! That fixed it for me! Apparently it doesn't just look in the current directory if you only specify a file name without a path. It seems like it should default to looking in the current directory.
So my script runs now, but even with -headless it displays the Squeak splash screen and the VM never exits. I have to manually kill the process. Is there something I should do at the end of my script to make it exit? It seems like with -headless it should always exit when it reaches the end of the script.
--- Mark Volkmann
Thanks! That fixed it for me! Apparently it doesn't just look in the current directory if you only specify a file name without a path. It seems like it should default to looking in the current directory.
So my script runs now, but even with -headless it displays the Squeak splash screen and the VM never exits. I have to manually kill the process. Is there something I should do at the end of my script to make it exit? It seems like with -headless it should always exit when it reaches the end of the script.
Mark Volkmann
If you use an image with Installer-Launcher in it, then you can append
SmalltalkImage +save +quit SmalltalkImage save=newImageName +quit SmalltalkImage +quit
The best way to add Installer-Launcher is as part of the Level Playing Field tools. http://installer.pbwiki.com/LevelPlayingField
Keith
On Fri, Oct 24, 2008 at 07:39:59PM -0500, Mark Volkmann wrote:
So my script runs now, but even with -headless it displays the Squeak splash screen and the VM never exits. I have to manually kill the process. Is there something I should do at the end of my script to make it exit? It seems like with -headless it should always exit when it reaches the end of the script.
Just add this to the end of your script: SmalltalkImage current snapshot: false andQuit: true.
Or, if you want more of a brute force exit, you can use this: SmalltalkImage current quitPrimitive.
While you are at it, take a few minutes to read the #snapshot:andQuit:embedded method. This is where the magic occurs that permits you to save an image and restart it exactly where you left off. Interesting and well worth reading.
Dave
On Oct 24, 2008, at 8:36 PM, David T. Lewis wrote:
On Fri, Oct 24, 2008 at 07:39:59PM -0500, Mark Volkmann wrote:
So my script runs now, but even with -headless it displays the Squeak splash screen and the VM never exits. I have to manually kill the process. Is there something I should do at the end of my script to make it exit? It seems like with -headless it should always exit when it reaches the end of the script.
Just add this to the end of your script: SmalltalkImage current snapshot: false andQuit: true.
That does a lot of stuff! However, one thing it didn't do for me ... under Windows ... is quit.
Or, if you want more of a brute force exit, you can use this: SmalltalkImage current quitPrimitive.
This does work though!
While you are at it, take a few minutes to read the #snapshot:andQuit:embedded method. This is where the magic occurs that permits you to save an image and restart it exactly where you left off. Interesting and well worth reading.
Thanks!
--- Mark Volkmann
Am 25.10.2008 um 02:39 schrieb Mark Volkmann:
It seems like with -headless it should always exit when it reaches the end of the script.
As was mentioned before the mechanism you are (ab-)using was never meant to run unixy scripts. The ProjectLauncher which parses the command line in a regular image is designed to, err, launch projects, in the web browser plugin, that is (see the class comment on AbstractLauncher).
You can of course customize your image to do anything on startup, including quitting after reading a script, if a deprecated platform- dependent argument like -headless was passed to the VM. That may not be the brightest idea but if it gets the job done I have to admit doing worse before ;)
- Bert -
On Oct 25, 2008, at 4:07 AM, Bert Freudenberg wrote:
Am 25.10.2008 um 02:39 schrieb Mark Volkmann:
It seems like with -headless it should always exit when it reaches the end of the script.
As was mentioned before the mechanism you are (ab-)using was never meant to run unixy scripts.
I'm curious. Is there a technical reason why this is the case? I'll bet there are lots of people who prefer Smalltalk syntax to ... say Ruby syntax (my second favorite language). They would probably love to be able to use Smalltalk for unixy types of scripts. Ruby and JRuby have to start a VM just like Squeak does so it seems like Squeak could be a suitable replacement.
--- Mark Volkmann
Am 25.10.2008 um 17:53 schrieb Mark Volkmann:
On Oct 25, 2008, at 4:07 AM, Bert Freudenberg wrote:
Am 25.10.2008 um 02:39 schrieb Mark Volkmann:
It seems like with -headless it should always exit when it reaches the end of the script.
As was mentioned before the mechanism you are (ab-)using was never meant to run unixy scripts.
I'm curious. Is there a technical reason why this is the case?
No.
- Bert -
Hello Mark,
MV> So my script runs now, but even with -headless it displays the Squeak MV> splash screen
There's a splash.bmp in your Squeak directory, if you delete (or replace) it there is no or your splash screen.
Cheers,
Herbert
On Thu, Oct 23, 2008 at 5:47 AM, David T. Lewis lewis@mail.msen.com wrote:
The "-headless" option definitely works for the unix VM. I don't know about OS X or Windows.
There is also -nodisplay. From what I understand, -headless just prevents the VM from opening its window (so you still need to run a graphics server), and -nodisplay loads a dummy display plugin, so in theory you don't even need the X11 libraries on the machine.
Now I'm also trying to run a headless image on linux, but nothing happens. There is a WAKom + Seaside running in the image but it doesn't listen. Since squeak doesn't give any hint of whichever state it's in… Only problem I see is that some plugins require X11 even though I ran configure with --without-x, so at least there is a bug in the autoconf scripts. NB. The exact same image runs perfectly fine on Mac (headless or not).
On Sat, 25 Oct 2008 15:00:04 +0200, Damien Pollet wrote:
On Thu, Oct 23, 2008 at 5:47 AM, David T. Lewis lewis@mail.msen.com wrote:
The "-headless" option definitely works for the unix VM. I don't know about OS X or Windows.
There is also -nodisplay. From what I understand, -headless just prevents the VM from opening its window (so you still need to run a graphics server), and -nodisplay loads a dummy display plugin, so in theory you don't even need the X11 libraries on the machine.
Now I'm also trying to run a headless image on linux, but nothing happens.
I run the Squeak VM with -memory 20m -vm-display-null under Linux (debian) as a daemon and for being able to listen it needs to be empowered (which is often forgotten).
If you're logged on as root, does it do what you want when started from command line?
There is a WAKom + Seaside running in the image but it doesn't listen. Since squeak doesn't give any hint of whichever state it's in… Only problem I see is that some plugins require X11 even though I ran configure with --without-x, so at least there is a bug in the autoconf scripts. NB. The exact same image runs perfectly fine on Mac (headless or not).
On Sat, Oct 25, 2008 at 2:26 PM, Klaus D. Witzel klaus.witzel@cobss.com wrote:
If you're logged on as root, does it do what you want when started from command line?
Why should I ? because only root can use port 80 ?
On Sun, Oct 26, 2008 at 5:40 PM, Damien Pollet damien.pollet@gmail.com wrote:
On Sat, Oct 25, 2008 at 2:26 PM, Klaus D. Witzel klaus.witzel@cobss.com wrote:
If you're logged on as root, does it do what you want when started from command line?
Why should I ? because only root can use port 80 ?
Meh. It's working on :8080…
Damien Pollet wrote:
On Sun, Oct 26, 2008 at 5:40 PM, Damien Pollet damien.pollet@gmail.com wrote:
On Sat, Oct 25, 2008 at 2:26 PM, Klaus D. Witzel klaus.witzel@cobss.com wrote:
If you're logged on as root, does it do what you want when started from command line?
Why should I ? because only root can use port 80 ?
Meh. It's working on :8080…
Yes, that's to be expected. Ports < 1024 require root privileges.
Cheers, - Andreas
Am 26.10.2008 um 18:00 schrieb Andreas Raab:
Damien Pollet wrote:
On Sun, Oct 26, 2008 at 5:40 PM, Damien Pollet <damien.pollet@gmail.com
wrote: On Sat, Oct 25, 2008 at 2:26 PM, Klaus D. Witzel <klaus.witzel@cobss.com
wrote: If you're logged on as root, does it do what you want when started from command line?
Why should I ? because only root can use port 80 ?
Meh. It's working on :8080…
Yes, that's to be expected. Ports < 1024 require root privileges.
... which is why typically Squeak servers sit behind a proxying Apache web server.
- Bert -
Yes, what's strange is I tried with :8080 before and it was failing… I will blame the lack of caffeine :)
On Sun, Oct 26, 2008 at 6:15 PM, Bert Freudenberg bert@freudenbergs.de wrote:
Am 26.10.2008 um 18:00 schrieb Andreas Raab:
Damien Pollet wrote:
On Sun, Oct 26, 2008 at 5:40 PM, Damien Pollet damien.pollet@gmail.com wrote:
On Sat, Oct 25, 2008 at 2:26 PM, Klaus D. Witzel klaus.witzel@cobss.com wrote:
If you're logged on as root, does it do what you want when started from command line?
Why should I ? because only root can use port 80 ?
Meh. It's working on :8080…
Yes, that's to be expected. Ports < 1024 require root privileges.
... which is why typically Squeak servers sit behind a proxying Apache web server.
- Bert -
squeak-dev@lists.squeakfoundation.org