Package de.afoo.sdnotify
Interface SDNotify
- All Known Implementing Classes:
ActualSDNotify,NOOPSDNotify
public interface SDNotify
Send Notifications to systemd.
See https://www.freedesktop.org/software/systemd/man/sd_notify.html.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanNotify systemd that a D-Bus error has occurred.static SDNotifycreate()Create a new SDNotify instance.booleanerrno(int errno) Notify systemd that an error has occurred.booleanextendTimeout(Duration duration) Tells the service manager to extend the startup, runtime or shutdown service timeout corresponding the current state.booleanmainPid(int pid) Inform systemd of the main pid of the service.booleanready()Notify systemd that the service has started successfully.booleanNotify systemd that the service is currently reloading.booleanSend a free form status message to systemd.booleanstopping()Notify systemd that the service is stopping.booleanwatchdog()Update the watchdog timestamp for services with WatchDogSec enabled.booleanAn error that should be handled by the watchdog options occured.
-
Method Details
-
create
Create a new SDNotify instance. Returns a NOOP Variant if theNOTIFY_SOCKETenvironment variable is not set (for example on Windows).- Returns:
- an appropriate SDNotify instance
-
ready
boolean ready()Notify systemd that the service has started successfully. This has to be sent for services of Type=notify to be considered running by systemd.- Returns:
- if the message was successfully sent
-
status
Send a free form status message to systemd.- Parameters:
message- the message to be sent- Returns:
- if the message was successfully sent
-
reloading
boolean reloading()Notify systemd that the service is currently reloading.ready()must be called once this reloading has finished.- Returns:
- if the message was successfully sent
-
stopping
boolean stopping()Notify systemd that the service is stopping.- Returns:
- if the message was successfully sent
-
errno
boolean errno(int errno) Notify systemd that an error has occurred.- Parameters:
errno- the ERRNO of the error- Returns:
- if the message was successfully sent
-
busError
Notify systemd that a D-Bus error has occurred.- Parameters:
error- a description of the error- Returns:
- if the message was successfully sent
-
mainPid
boolean mainPid(int pid) Inform systemd of the main pid of the service. This is only necessary under special circumstances.- Parameters:
pid- the main pic- Returns:
- if the message was successfully sent
-
watchdog
boolean watchdog()Update the watchdog timestamp for services with WatchDogSec enabled.- Returns:
- if the message was successfully sent
-
watchdogTrigger
boolean watchdogTrigger()An error that should be handled by the watchdog options occured.- Returns:
- if the message was successfully sent
-
extendTimeout
Tells the service manager to extend the startup, runtime or shutdown service timeout corresponding the current state.- Parameters:
duration- the new value of the timeout- Returns:
- if the message was successfully sent
-