openmediavault  4.0 (Arrakis)
The open network attached storage solution
Public Member Functions | Static Public Member Functions | List of all members
OMV\System\SystemCtl Class Reference

Public Member Functions

 __construct ($name)
 
 getName ()
 
 setOption ($arg)
 
 clearOptions ()
 
 enable ($now=FALSE, $quiet=FALSE)
 
 disable ($now=FALSE, $quiet=FALSE)
 
 reenable ($quiet=FALSE)
 
 isEnabled ()
 
 start ($quiet=FALSE)
 
 stop ($quiet=FALSE)
 
 restart ($quiet=FALSE)
 
 reload ($quiet=FALSE)
 
 isMasked ()
 
 mask ($quiet=FALSE)
 
 unmask ($quiet=FALSE)
 
 isActive ()
 
 waitUntilActive ($timeout)
 
 kill ($signal, $quiet=FALSE)
 

Static Public Member Functions

static escape ($str, $options)
 

Detailed Description

Control the systemd system and service manager.

Constructor & Destructor Documentation

◆ __construct()

OMV\System\SystemCtl::__construct (   $name)

Constructor

Parameters
nameThe name of the unit, e.g. ssh.

Member Function Documentation

◆ clearOptions()

OMV\System\SystemCtl::clearOptions ( )

Reset the list of command options.

◆ disable()

OMV\System\SystemCtl::disable (   $now = FALSE,
  $quiet = FALSE 
)

Disable the specified unit file.

Parameters
nowSet to TRUE to stop the unit after it has been disabled. Defaults to FALSE.

◆ enable()

OMV\System\SystemCtl::enable (   $now = FALSE,
  $quiet = FALSE 
)

Enable the specified unit file.

Parameters
nowSet to TRUE to start the unit after it has been enabled. Defaults to FALSE.

◆ escape()

static OMV\System\SystemCtl::escape (   $str,
  $options 
)
static

Escape strings for usage in system unit names.

See also
https://www.freedesktop.org/software/systemd/man/systemd-escape.html
Parameters
strThe string to escape.
optionsAn array of 'systemd-escape' options.
Returns
Returns the escaped string.
Exceptions

◆ getName()

OMV\System\SystemCtl::getName ( )

Get the name of the unit.

Returns
The name of the unit.

◆ isActive()

OMV\System\SystemCtl::isActive ( )

Check whether the specified unit is active (i.e. running).

Returns
TRUE if the unit is active, otherwise FALSE.

◆ isEnabled()

OMV\System\SystemCtl::isEnabled ( )

Checks whether the specified unit file is enabled.

Returns
TRUE if the unit is enabled, otherwise FALSE.

◆ isMasked()

OMV\System\SystemCtl::isMasked ( )

Checks whether the specified unit file is masked.

Returns
TRUE if the unit is masked, otherwise FALSE.

◆ kill()

OMV\System\SystemCtl::kill (   $signal,
  $quiet = FALSE 
)

Send a signal to the process of the unit.

Parameters
signalMust be one of the well known signal specifiers such as SIGHUP, SIGTERM, SIGINT or SIGSTOP.

◆ mask()

OMV\System\SystemCtl::mask (   $quiet = FALSE)

Mask the specified unit file.

◆ reenable()

OMV\System\SystemCtl::reenable (   $quiet = FALSE)

Reenable the specified unit file.

◆ reload()

OMV\System\SystemCtl::reload (   $quiet = FALSE)

Asks the specified unit to reload its configuration.

◆ restart()

OMV\System\SystemCtl::restart (   $quiet = FALSE)

Restart the specified unit.

◆ setOption()

OMV\System\SystemCtl::setOption (   $arg)

Set a command option.

◆ start()

OMV\System\SystemCtl::start (   $quiet = FALSE)

Start (activate) the specified unit.

◆ stop()

OMV\System\SystemCtl::stop (   $quiet = FALSE)

Stop (deactivate) the specified unit.

◆ unmask()

OMV\System\SystemCtl::unmask (   $quiet = FALSE)

Unmask the specified unit file.

◆ waitUntilActive()

OMV\System\SystemCtl::waitUntilActive (   $timeout)

Wait until the specified unit is active. If the unit is not active within the given time, then an exception is thrown.

Parameters
timeoutTimeout in seconds to wait for an active unit.
Returns
None.
Exceptions

The documentation for this class was generated from the following file: