Welcome, Guest. Please login or register.

Author Topic: Daemon management on Amiga OS  (Read 11841 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Tygre

Re: Daemon management on Amiga OS
« on: February 19, 2021, 11:17:44 PM »
Hi NinjaCyborg!

Something that bothered me in the 90s and has been bothering me again now is that Amiga OS doesn't have a centralised 'daemon / service management' system. it has a number of unconnected systems that can be used to do some of the things that launchd or initd/systemd+systemctl do.

I wonder if Run, WBRun, and IconX could be rewritten such that, when running a program/script, they create a commodity with the name of that program/script. This commodity would send CTRL+C when selecting "Remove" or CTRL+D (or E?) when selecting "Active/Inactive" to the program/script :)

That way, most (all?) commands would be "visible" in Exchange and controllable...

Any thoughts?

Cheers!

Offline Tygre

Re: Daemon management on Amiga OS
« Reply #1 on: February 20, 2021, 04:04:42 PM »
I tried but couldn't make it work, could you?

Anyways, its readme says that MakeCX works only with a program with a window and a close gadget: it seems to me that MakeCX can just send the IDCMP_CLOSEWINDOW event to a program. Besides, it requires a lot of parameters...

I think that a "RunCX" command would be better: it would send CTRL+F and IDCMP_CLOSEWINDOW to a program (with or without window) and it should pull from the command line/WBStartup the info. about the program name, path, etc. More like WBRun does...

Offline Tygre

Re: Daemon management on Amiga OS
« Reply #2 on: February 23, 2021, 09:53:10 PM »
Hi NinjaCyborg and all!

Good point about MakeCX. So what would a 'CXRun' command look like that really works how you're thinking? Here's some ideas.

For GUI apps that aren't commodities, any of FKey, ToolManager or AmiDock (and probably some others) can give you a keyboard shortcut to launch them.

Good point! But CXRun would have a slightly different purpose and use case: once run using CXRun (maybe from FKey...), these non-commodity programs would appear "as" commodities, with entries in Exchange :) "Show"/"Hide" would just (if possible) move their windows forward/backward and "Remove" would send them a CTRL+F and a "ICDMP_CLOSEWINDOW". (I think that nothing much else can be done? I don't think possible to really "hide" the window of a program not made for it...)
 
But the launching app has no way to keep some state about the app it launched - press the shortcut again and it will try to launch the app again, which may or may not do anything depending on whether the app allows more than instance of itself to run. And unless the app is itself a commodity then you don't have show/hide, pause/resume and exit commands to send to it. Even if it is a commodity, then it will likely have it's own keyboard shortcut, but a different one from the one used to launch it as the launching app doesn't know to yield the shortcut it's using!

So first of all, a smarter solution would let you assign the shortcut, and then it would upon launching the app, yield it's own hold on that shortcut combo, in anticipation of the app it launched reregistering the shortcut for itself. This actually means you can make a nice trick - it can wake up every 5 seconds say, attempt to re-register the same shortcut, and if it fails it knows the app is still running (or has crashed... I know it can't handle that scenario unfortunately), if it succeeds it knows the app has exit, and return to it's original mode.

This solves one issue for me that's always bothered me. I want the shortcuts for certain commodities to always be active, without having to load them all into memory. I have a similar issue which is that I want certain rexx ports to always be available, and the app that hosts them only run when the port is accessed lazy-loading style. Again, the service manager would need to register the port, and then yield it when addressed however in this case it would be destroyed and then reallocated, it couldn't simply be passed to the new host.

However if we're launching an app that isn't a commodity, we might only have options like sending a Ctrl-C signal or a fake Window Close IDCMP message like MakeCX does (and then we need to know process names or window names to know where to send it). Or, it might have a rexx port but then we need some way to tell our 'service manager' what commands to send, to what port, for show/hide,suspend/resume,exit etc. Actually application.library tries to do this and adds 'new document', 'open document' and other message types. But It needs the host app to support it itself (and it's OS4 only).

However, a init.d type scripting framework with shell scripts that contain the commands that need to be sent to control a given system could work. For each piece of software you want to control in this way you'd have a script with sections that say what to do - app1 is a commodity, named 'AppX', app2 has a rexxport call 'APP2HOST.1' and the command to exit is QUIT for example

Anyway these are just thoughts for fun.

For programs that have no window (and that are not commodities), e.g., AssignWedge, CXRun will again create an entry into Exchange: "Show"/"Hide" would do nothing (or be disabled entirely) and "Remove" would send them a CTRL+F.

So, any program that is not a commodity becomes "visible" as a commodity in Exchange and, as much as possible, controllable from Exchange 8)

In a way, Exchange would become the "command center" of the Amiga, there would be no need to look at the list of processes/tasks anymore, to know what's running. It would also give greater control on these programs that have no windows/are not commodities.

What do you think?

Cheers!
« Last Edit: February 23, 2021, 09:54:57 PM by Tygre »
 

Offline Tygre

Re: Daemon management on Amiga OS
« Reply #3 on: February 25, 2021, 12:04:10 AM »
@Tygre
I am still wondering why you wish to send Ctrl+F to programs, I don't know of any software that handles that as "quit", do you?

Yes, I meant CTRL+C, good catch and thank you for your contribution!

Offline Tygre

Re: Daemon management on Amiga OS
« Reply #4 on: February 25, 2021, 03:15:05 PM »
A further thought, inspired by looking again at Ranger's functionality. A subset of what Ranger does, parsing the DOS processes list to find processes spawned by Workbench, and then providing that as a list that can be used to drive a UI for managing your 'user apps'. One could make a docky for example that automatically added an icon for every app spawned by Workbench (and let's say, that's NOT in the wbstartup list) rather than relying on developers to implement it themselves, badly (although I do wish AmiDock worked like the mac dock, where the icon for the unlaunched app, and the icon for managing the open app coexist in the same space). And in many cases Workbench can be used to actually spawn new processes by sending it wbrun commands or using workbench library or rexx, rather than necessitating a separate service manager process.

Anyway when I get some time I am going to prototype some of these ideas.

PS. What is Ranger? I searched Google but found only the Ranger prototype and Aminet returns nothing?

Offline Tygre

Re: Daemon management on Amiga OS
« Reply #5 on: February 25, 2021, 04:32:33 PM »
Hi NinjaCyborg!

Level 1 - tasks you don't need awareness of at all. iprefs, filesystems, intuition etc.
Level 2 - tasks that are services you mostly don't need much visibility of but occasionally do - rexxmast, usb stacks, timidity, tcp ip stack, and tcp services you run e.g. ftpd
Level 3 - things that make good commodities, where the UI is frequently available but hidden when not needed
Level 4 - things you use actively where the UI is always available and which are under your direct control

Good taxonomy! :)

A service manager would be useful for level 2. a CXRun type tool to make more things commodities that aren't would be good for level 3. Application library is good for level 4, if they ever finish fulfilling it's potential.

Yes, absolutely! A user could also use it for Level 2 but that might clutter needlessly her Exchange ;)

The commodities path is worth exploring, after all it is the existing tool for managing background processes that want to be managed. It's just not used in that way enough by developers. I think the makecx approach of messing around with IDCMP close window is a mistake, as it relies on non unique window names and so on. Better to just send a control C, this usually works e.g. with calculator, and if you spawned the process you will know it's ID. In fact the best approach might be a service that stay resident keeping track of all the things it launches and sends messages to, and a separate shell command to control it. I see an architecture forming now.

My thoughts too: I haven't yet explore the source code of WBRun but, if possible, I would rather have as little parameters as possible for CXRun: it should itself "remember" the ID of the task/process that it runs, it should not need a window name, etc.

Let's find some time to code now ;D
 
The following users thanked this post: NinjaCyborg

Offline Tygre

Re: Daemon management on Amiga OS
« Reply #6 on: February 25, 2021, 09:01:47 PM »
Thanks for the info. @nbache and @NinjaCyborg!

I bought a copy of AmigaOS4 (some years ago) but don't have it running currently...

For AmigaOS3, there SysInspector but my favourites are Commander (with Executive) and Scout.

Cheers!