Welcome, Guest. Please login or register.
Amiga Kit Amiga Store Hollywood MAL AMIStore App Store A600 Memory

AuthorTopic: Daemon management on Amiga OS  (Read 3132 times)

0 Members and 1 Guest are viewing this topic.

Offline NinjaCyborg

Daemon management on Amiga OS
« on: February 12, 2021, 12:29:03 PM »
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.

For example, there is:
  • Startup-Sequence and User-Startup, where a number of system processes are launched, like IPrefs
  • WBStartup where anything can be launched but generally helper apps with GUIs is what you want in there, especially those that depend on Workbench already being initialised
  • commodities.library can be used to make background programs that popup on demand or otherwise perform some automated background action
  • Break can be used to send simple messages to running processes
  • Run can be used to spawn background processes
  • Kickstart processes started by the bootstrap
  • application.library which but being new to OS4 is not widely supported and again seems mostly for GUI apps
  • Services feature in various TCP stacks which can start a service to handle incoming request on TCP/IP port

A lot can be done with this list but things it can't do include:
  • Restarting a task if it ends unexpectedly, fundamental to the concept of a 'daemon'
  • Create a common place for stdout/stderr logs for background tasks
  • Making sure that only 'one' of a given process runs, where that's desirable, although other mechanisms exist with partial support for that including application library, including unique rexx port naming, only one server can bind to a IP port etc.
  • Start an app if it isn't already running on some trigger such as keyboard shortcut for a commodity or access to a rexx port. So for example if you want to have rexx script depending on presence of a particular port, you have to write your own 'if port exists address it or otherwise guess where it's installed and run it first and wait'. If you want to launch an commodity by keyboard shortcut, you better make sure it's in wbstartup - admittedly this is less of an issue now everyone has lots of RAM but it was an issue in the 90s.
  • Sending a Break requires a Process number lookup to find the right process
  • Heartbeat actions to check a process is responding
  • Ensure that dependencies exist before starting, and then auto start once the dependencies are met e.g. that Workbench is running or specific mounted volume exists or that networking is up.
  • Auto termination of a task upon certain events such as network offline or disk eject/unmount
  • Auto reload of a settings file after it's saved, on a general basis. Individual apps can do this but most don't.
  • Centralised command line control of the sort offered by systemctl - instead every app has it's own way of doing things
  • Out of the box, write apps that trigger on events like time events or disk mount/unmount, although there are apps that do that specific job including cron commodities

I appreciate lack of crash protection (memory protection, resource tracking) means that if a task dies you're stuck with it. I also appreciate that it's often quicker and easier to just reboot an Amiga than restart a specific service. Still it would be nice to do things 'better' wouldn't it?

What do you guys all think?

I think it could be largely built with only shell and rexx scripts actually, at least to prototype it. As with init.d you would have a shell script for each process you want to 'daemonize' that has entry points for start, stop, restart, status, debug mode etc.

So let's say for the wifi 'C:WirelessManager' command you would define a status command as showing the tail of it's log output, debug mode would set the verbose flag, stop would send a Break C to process called "WirelessManager" etc.
 

Offline kolla

Re: Daemon management on Amiga OS
« Reply #1 on: February 12, 2021, 07:41:09 PM »
Don't you know that ThoR passionatly detest systemd? So much that he created System-Startup for OS 3.2 (so that everyone who believes in him may not die in vain, but have eternal life... heh)

As you say, you can largely build what you want using shell and arexx scripts, so you can just go ahead and implement away already.
B5D6A1D019D5D45BCC56F4782AC220D8B3E2A6CC
---
A3000/060CSPPC+CVPPC/128MB + 256MB BigRAM/Deneb USB
A4000/CS060/Mediator4000Di/Voodoo5/128MB
A1200/Blz1260/IndyAGA/192MB
A1200/Blz1260/64MB
A1200/Blz1230III/32MB
A1200/ACA1221
A600/V600v2/Subway USB
A600/Apollo630/32MB
A600/A6095
CD32/SX32/32MB/Plipbox
CD32/TF328
A500/V500v2
A500/MTec520
CDTV
MiSTer, MiST, FleaFPGAs and original Minimig
Peg1, SAM440 and Mac minis with MorphOS
 

Offline NinjaCyborg

Re: Daemon management on Amiga OS
« Reply #2 on: February 12, 2021, 08:18:36 PM »
You just can't resist the opportunity to take digs at Thor can you. Go away.

Offline Pat the Cat

Re: Daemon management on Amiga OS
« Reply #3 on: February 12, 2021, 09:23:20 PM »
Quote
Wouldn't it be nice if Amigas just always worked all the time when you turned them on?

Yes. Yes, it would. Far more people would use them on a day to day basis.

The same could be said about any computing device.
"To recurse is human. To iterate, divine."

A1200, Vanilla, Surf Squirrel, SD Card, KS 3.0/3.z, PCMCIA dev
A500, Vanilla, A570, Rev 5, KS 1.2/1.3 Testbench system
Rasp Pi, UAE4ARM, 3D laser scanner, experimental, hoping for AmigaOS4Arm, based on Watterott Fabscan Pi
 

Offline NinjaCyborg

Re: Daemon management on Amiga OS
« Reply #4 on: February 12, 2021, 09:25:27 PM »
Sorry, is that meant to be funny?
 

Offline kolla

Re: Daemon management on Amiga OS
« Reply #5 on: February 12, 2021, 10:45:21 PM »
You just can't resist the opportunity to take digs at Thor can you.

The "dig" was at you, really. I just find it funny how you’re essentially asking for systemd for AmigaOS, given his stance on systemd... have you tried emailing him your ideas? He may have an oppinion or ... ten on this matter, and he is the guy who described System-Startup of OS 3.2 as a sort of initd for AmigaOS, so this is absolutely relevant.
B5D6A1D019D5D45BCC56F4782AC220D8B3E2A6CC
---
A3000/060CSPPC+CVPPC/128MB + 256MB BigRAM/Deneb USB
A4000/CS060/Mediator4000Di/Voodoo5/128MB
A1200/Blz1260/IndyAGA/192MB
A1200/Blz1260/64MB
A1200/Blz1230III/32MB
A1200/ACA1221
A600/V600v2/Subway USB
A600/Apollo630/32MB
A600/A6095
CD32/SX32/32MB/Plipbox
CD32/TF328
A500/V500v2
A500/MTec520
CDTV
MiSTer, MiST, FleaFPGAs and original Minimig
Peg1, SAM440 and Mac minis with MorphOS
 

Offline TribbleSmasher

Re: Daemon management on Amiga OS
« Reply #6 on: February 13, 2021, 01:20:13 PM »
I don't feel the need to turn AmigaOS into yet another Linux with hundreds of tasks running doing nothing most of the time and restarting at own will while cluttering the drive with log files nobody ever reads.
Leave AOS alone as it is, make small improvements along and all is gooood.
 

Offline NinjaCyborg

Re: Daemon management on Amiga OS
« Reply #7 on: February 13, 2021, 02:02:48 PM »
Well that's the point of a services manager, so when they're doing nothing they're really doing nothing, rather than taking up memory unnecessarily. OS3 might not have many standard system processes but look at a vanilla OS4 install how many background tasks are running. That's not a dig at OS4, it's necessary to support USB, compositing etc.
 

Offline kolla

Re: Daemon management on Amiga OS
« Reply #8 on: February 13, 2021, 04:39:57 PM »
The "service manager" is the Exchange commodity - just make sure all your software you run has commodity interface, and you can enable and disable at will. By using MUI programs, you already have a head start, as all MUI software inherently also have commodity interfaces. And there is both rexx and CLI interfaces to talk with the commodity interface.
B5D6A1D019D5D45BCC56F4782AC220D8B3E2A6CC
---
A3000/060CSPPC+CVPPC/128MB + 256MB BigRAM/Deneb USB
A4000/CS060/Mediator4000Di/Voodoo5/128MB
A1200/Blz1260/IndyAGA/192MB
A1200/Blz1260/64MB
A1200/Blz1230III/32MB
A1200/ACA1221
A600/V600v2/Subway USB
A600/Apollo630/32MB
A600/A6095
CD32/SX32/32MB/Plipbox
CD32/TF328
A500/V500v2
A500/MTec520
CDTV
MiSTer, MiST, FleaFPGAs and original Minimig
Peg1, SAM440 and Mac minis with MorphOS
 

Offline cgutjahr

Re: Daemon management on Amiga OS
« Reply #9 on: February 14, 2021, 08:52:19 PM »
If there's one thing AmigaOS definitely doesn't need it's daemons or service managers or whatever you want to call them. The whole point of AmigaOS is its modularity - of course it's the TCP stack's job to start a service if a request comes in  via a certain port. And if I need to react to a file changing or a device being mounted, I tell dos.library about it, because that is (or should be) dos.library's effing job.

daemons make sense in a multiuser-environment, where anything running in my session can never directly talk to anything important - because another user's session might be trying to do the exact same thing at the exact same time. But on AmigaOS? It would just introduce another software layer and making stuff more complex because it might make things slightly more comfortable is never a good idea. "Keep it simple, stupid".
 

Offline kolla

Re: Daemon management on Amiga OS
« Reply #10 on: February 16, 2021, 12:56:48 AM »
of course it's the TCP stack's job to start a service if a request comes in  via a certain port.

Not at all - that's the task of an inet daemon, not a TCP stack.

And AmigaOS is full of "daemons", like IPrefs, like commodities, like rexxmast...
« Last Edit: February 16, 2021, 12:58:38 AM by kolla »
B5D6A1D019D5D45BCC56F4782AC220D8B3E2A6CC
---
A3000/060CSPPC+CVPPC/128MB + 256MB BigRAM/Deneb USB
A4000/CS060/Mediator4000Di/Voodoo5/128MB
A1200/Blz1260/IndyAGA/192MB
A1200/Blz1260/64MB
A1200/Blz1230III/32MB
A1200/ACA1221
A600/V600v2/Subway USB
A600/Apollo630/32MB
A600/A6095
CD32/SX32/32MB/Plipbox
CD32/TF328
A500/V500v2
A500/MTec520
CDTV
MiSTer, MiST, FleaFPGAs and original Minimig
Peg1, SAM440 and Mac minis with MorphOS
 

Offline NinjaCyborg

Re: Daemon management on Amiga OS
« Reply #11 on: February 17, 2021, 02:21:20 PM »
No need to be pedantic. Yes it's the job of inetd. Inetd comes with the TCP/IP stack. It's called a stack, because it consists of multiple bits of interdependent software, and not just because the ISO OSI model is a 'stack'. But you already know that.
 

Offline kolla

Re: Daemon management on Amiga OS
« Reply #12 on: February 18, 2021, 12:41:59 PM »
No need to be pedantic. Yes it's the job of inetd. Inetd comes with the TCP/IP stack.
Huh, I am not pedantid, and no...
- an inetd doesn't always come with a TCP/IP stack, and when they do, they are very much optional
- they are most often not activated since that is considered a security risk.
- most inet daemons are stand alone and not directly associated with a TCP/IP stack, rinetd, xinetd, systemd socket - even on Amiga you can chose.

Quote
It's called a stack, because it consists of multiple bits of interdependent software

No, that is not why it is called a stack, you just made that up now.

Quote
and not just because the ISO OSI model is a 'stack'. But you already know that.

TCP/IP has little to do with the OSI model... TCP/IP specifically doesn't follow the OSI model - the TCP/IP stack is different from the OSI stack.

But you already know that.
B5D6A1D019D5D45BCC56F4782AC220D8B3E2A6CC
---
A3000/060CSPPC+CVPPC/128MB + 256MB BigRAM/Deneb USB
A4000/CS060/Mediator4000Di/Voodoo5/128MB
A1200/Blz1260/IndyAGA/192MB
A1200/Blz1260/64MB
A1200/Blz1230III/32MB
A1200/ACA1221
A600/V600v2/Subway USB
A600/Apollo630/32MB
A600/A6095
CD32/SX32/32MB/Plipbox
CD32/TF328
A500/V500v2
A500/MTec520
CDTV
MiSTer, MiST, FleaFPGAs and original Minimig
Peg1, SAM440 and Mac minis with MorphOS
 

Offline Tygre

Re: Daemon management on Amiga OS
« Reply #13 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 NinjaCyborg

Re: Daemon management on Amiga OS
« Reply #14 on: February 20, 2021, 07:46:48 AM »
There's actually an old command line tool that is like Run but creates a commodity entry for the running command. It's called MakeCX. I need to experiment with it to see how robust it is.