Start up actions

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Start up actions

Peter Kenny

Hello

 

I have a puzzle as to how to implement a start-up action. I would like to have a monitoring process running in the background while I am working on my project, and it would be easier if this process started up automatically when the image is loaded. I have hunted through my current image, and I have found three possibilities:

a.      Include a file named startup.st in the same folder as the image, and put a script to start the process in this file.

b.      Add a startup: method to the class controlling the background process, and do Smalltalk addToStartUpList: MyClass.

c.      Do Smalltalk addDeferredStartUpAction: [block which starts the process].

The first looks easiest, but it seems untidy to rely on having a separate file sored with the image. All these methods should work;  is there any reason to prefer any one of them, or any other better method?

 

Thanks in advance for any advice.

 

Peter Kenny

Reply | Threaded
Open this post in threaded view
|

Re: Start up actions

Sven Van Caekenberghe-2
The absolute simplest thing is to just create the process and save the image with it, it will keep on running.

> On 05 Nov 2014, at 12:05, PBKResearch <[hidden email]> wrote:
>
> Hello
>  
> I have a puzzle as to how to implement a start-up action. I would like to have a monitoring process running in the background while I am working on my project, and it would be easier if this process started up automatically when the image is loaded. I have hunted through my current image, and I have found three possibilities:
> a.      Include a file named startup.st in the same folder as the image, and put a script to start the process in this file.
> b.      Add a startup: method to the class controlling the background process, and do Smalltalk addToStartUpList: MyClass.
> c.      Do Smalltalk addDeferredStartUpAction: [block which starts the process].
> The first looks easiest, but it seems untidy to rely on having a separate file sored with the image. All these methods should work;  is there any reason to prefer any one of them, or any other better method?
>  
> Thanks in advance for any advice.
>  
> Peter Kenny


Reply | Threaded
Open this post in threaded view
|

Re: Start up actions

Carlo-2
Hi Peter

From my perspective option b. offers the most flexibility and is most explicit although the StartupLoader class (see class comments and examples) seems versatile and simple.

> a.      Include a file named startup.st in the same folder as the image, and put a script to start the process in this file.
Benefit of using an external file as start-up action is that it allows changes to be made to the script independent of the image. Have found this to be useful. Looks like newer images make use of StartupLoader class which uses defined process and lookup procedure to find startup scripts.

> b.      Add a startup: method to the class controlling the background process, and do Smalltalk addToStartUpList: MyClass.
Benefit is that you can make the startup process explicit and add some operational control methods here .e.g start process, report on process, end process.

> c.      Do Smalltalk addDeferredStartUpAction: [block which starts the process].
This is very low level entry and you could run this and save image but typically you would want to have some operational type control over the process, checks etc. So I would rather stick to a. or b.

Cheers
Carlo


On 05 Nov 2014, at 1:50 PM, Sven Van Caekenberghe <[hidden email]> wrote:

The absolute simplest thing is to just create the process and save the image with it, it will keep on running.

> On 05 Nov 2014, at 12:05, PBKResearch <[hidden email]> wrote:
>
> Hello
>
> I have a puzzle as to how to implement a start-up action. I would like to have a monitoring process running in the background while I am working on my project, and it would be easier if this process started up automatically when the image is loaded. I have hunted through my current image, and I have found three possibilities:
> a.      Include a file named startup.st in the same folder as the image, and put a script to start the process in this file.
> b.      Add a startup: method to the class controlling the background process, and do Smalltalk addToStartUpList: MyClass.
> c.      Do Smalltalk addDeferredStartUpAction: [block which starts the process].
> The first looks easiest, but it seems untidy to rely on having a separate file sored with the image. All these methods should work;  is there any reason to prefer any one of them, or any other better method?
>
> Thanks in advance for any advice.
>
> Peter Kenny