class Service
package digigun.sys.service
Provides integration with system service managers (systemd, SCM).
Static variables
Static methods
staticisAvailable():Bool
Checks if the application is running under a system service manager.
Returns:
True if running as a service and notifications are possible.
staticnotify(status:String):Bool
Reports status to the system service manager.
On Linux (systemd), this implements the sd_notify protocol. On Windows (SCM), this updates the service status.
Parameters:
status | The status string to send (e.g., Service.READY or "STATUS=Working"). |
|---|
Returns:
True if notification was successfully sent.
staticrun(name:String, onStart:() ‑> Void, onStop:() ‑> Void):Int
Runs the application as a system service.
On Windows, this performs the SCM handshake and blocks until the service is stopped. On POSIX, this executes onStart() and returns immediately (it does not daemonize).
Parameters:
name | The name of the service (Windows only). |
|---|---|
onStart | Callback when the service starts. |
onStop | Callback when the service is requested to stop. |
Returns:
0 on success, or OS error code on failure.