Dobby 3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
|
Wrapper for the upstart-dbus-bridge interface that allows starting and stopping system services. More...
#include <Upstart.h>
Public Member Functions | |
Upstart (const std::shared_ptr< AI_IPC::IIpcService > &ipcService) | |
bool | start (const std::string &name, const std::vector< std::string > &env=std::vector< std::string >(), bool wait=true) const |
Attempts to start the service with the given name. | |
bool | restart (const std::string &name, const std::vector< std::string > &env=std::vector< std::string >(), bool wait=true) const |
Attempts to perform a stop and a start on the service with the given name. | |
bool | stop (const std::string &name, bool wait=true) const |
Attempts to stop the service with the given name. | |
Private Member Functions | |
bool | invokeMethod (const std::string &method, const std::string &name, const std::vector< std::string > &env, bool wait) const |
Requests a start or a restart of a service. | |
Private Attributes | |
const std::shared_ptr< AI_IPC::IIpcService > & | mIpcService |
const std::string | mService |
const std::string | mInterface |
Wrapper for the upstart-dbus-bridge interface that allows starting and stopping system services.
Upstart is the init process of the system, it is responsible for starting things like mesh, the system dbus and others. It is an open source project run by ubuntu; http://upstart.ubuntu.com/.
This class is just a wrapper around it's dbus interface, the best documentation on the interface I found is here: https://github.com/bernd/ruby-upstart/blob/master/UPSTART-DBUS.md
/DBUS/etc/dbus-1/system.d/Upstart.conf
|
private |
Requests a start or a restart of a service.
Since the Start and Restart methods are near identical in the way they are called over dbus, this function performs either based on the method argument.
[in] | method | The method, should be either 'Start', 'Restart' or 'Stop'. |
[in] | name | The name of the service to start. |
[in] | env | Any extra environment variables to pass to the service being started |
[in] | wait | Waits till the service is running before returning. |
bool Upstart::restart | ( | const std::string & | name, |
const std::vector< std::string > & | env = std::vector<std::string>() , |
||
bool | wait = true |
||
) | const |
Attempts to perform a stop and a start on the service with the given name.
This issues the a Restart command on the dbus interface for the service with the given name. The equivalent on the command line would look like this:
dbus-send \ --system \ --print-reply \ --dest=com.ubuntu.Upstart \ /com/ubuntu/Upstart/jobs/<name> \ com.ubuntu.Upstart0_6.Job.Restart \ array:string:<env> boolean:<wait>
Note this function will return an error if the service wasn't running prior to the call.
[in] | name | The name of the service to restart. |
[in] | env | Any extra environment variables to pass to the service being restarted |
[in] | wait | Waits till the service is running before returning. |
bool Upstart::start | ( | const std::string & | name, |
const std::vector< std::string > & | env = std::vector<std::string>() , |
||
bool | wait = true |
||
) | const |
Attempts to start the service with the given name.
This issues the a Start command on the dbus interface for the service with the given name. The equivalent on the command line would look like this:
dbus-send \ --system \ --print-reply \ --dest=com.ubuntu.Upstart \ /com/ubuntu/Upstart/jobs/<name> \ com.ubuntu.Upstart0_6.Job.Start \ array:string:<env> boolean:<wait>
[in] | name | The name of the service to start. |
[in] | env | Any extra environment variables to pass to the service being started |
[in] | wait | Waits till the service is running before returning. |
bool Upstart::stop | ( | const std::string & | name, |
bool | wait = true |
||
) | const |
Attempts to stop the service with the given name.
This issues the a Stop command on the dbus interface for the service with the given name. The equivalent on the command line would look like this:
dbus-send \ --system \ --print-reply \ --dest=com.ubuntu.Upstart \ /com/ubuntu/Upstart/jobs/<name> \ com.ubuntu.Upstart0_6.Job.Stop \ array:string:'' boolean:<wait>
[in] | name | The name of the service to stop. |
[in] | wait | Waits till the service is stopped before returning. |