Documentation
¶
Index ¶
- Constants
- type T
- func (t *T) Activated(ctx context.Context) (bool, error)
- func (t *T) CalledFromManager() bool
- func (t *T) Close() error
- func (t *T) Defined(ctx context.Context) (loaded bool, err error)
- func (t *T) IsSystemStopping() (bool, error)
- func (t *T) NotifyReady() (bool, error)
- func (t *T) NotifyStopping() (bool, error)
- func (t *T) NotifyWatchdog() (bool, error)
- func (t *T) Restart() error
- func (t *T) Start(ctx context.Context) error
- func (t *T) Stop(ctx context.Context) error
Constants ¶
const (
UnitName = "opensvc-server.service"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type T ¶
type T struct {
// contains filtered or unexported fields
}
T handle dbus.Conn for systemd
func New ¶
New provides a connected object to dbus systemd that implement following interfaces:
Activated(ctx context.Context) (bool, error) CalledFromManager() bool Close() error NotifyWatchdog() (bool, error) Start(ctx context.Context) error Stop(ctx context.Context) error
func (*T) CalledFromManager ¶
CalledFromManager detects if current process as been launched by systemd
func (*T) Defined ¶
Defined verify if opensvc systemd unit exists and returns true and job type when unit is loaded
func (*T) IsSystemStopping ¶
func (*T) NotifyReady ¶
NotifyReady sends NotifyReady to systemd
func (*T) NotifyStopping ¶
NotifyStopping sends NotifyStopping to systemd
func (*T) NotifyWatchdog ¶
NotifyWatchdog sends watch dog notify to systemd
func (*T) Restart ¶
Restart restarts the opensvc systemd unit
restart calls systemd-run systemctl restart opensvc-agent. This allows the command to be attached on another control group and prevent systemd warnings during 'om daemon restart' such as:
systemd[1]: Stopping OpenSVC server... systemd[1]: opensvc-server.service: Succeeded. systemd[1]: Stopped OpenSVC server. systemd[1]: opensvc-server.service: Found left-over process 2899690 (om) in control group while starting unit. Ignoring. systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies. systemd[1]: opensvc-server.service: Found left-over process 2899697 (systemctl) in control group while starting unit. Ignoring. systemd[1]: This usually indicates unclean termination of a previous run, or service implementation deficiencies. systemd[1]: Starting OpenSVC server... systemd[1]: Started OpenSVC server.