Dobby 3.0
Dobby “Docker based Thingy” is a tool for managing and running OCI containers using crun
Loading...
Searching...
No Matches
Upstart.h
1/*
2* If not stated otherwise in this file or this component's LICENSE file the
3* following copyright and licenses apply:
4*
5* Copyright 2016 Sky UK
6*
7* Licensed under the Apache License, Version 2.0 (the "License");
8* you may not use this file except in compliance with the License.
9* You may obtain a copy of the License at
10*
11* http://www.apache.org/licenses/LICENSE-2.0
12*
13* Unless required by applicable law or agreed to in writing, software
14* distributed under the License is distributed on an "AS IS" BASIS,
15* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16* See the License for the specific language governing permissions and
17* limitations under the License.
18*/
19/*
20 * File: Upstart.h
21 *
22 */
23#ifndef UPSTART_H
24#define UPSTART_H
25
26#include <IIpcService.h>
27
28#include <memory>
29#include <string>
30#include <vector>
31
32// -----------------------------------------------------------------------------
54{
55public:
56 explicit Upstart(const std::shared_ptr<AI_IPC::IIpcService>& ipcService);
57 ~Upstart() = default;
58
59public:
60 bool start(const std::string& name,
61 const std::vector<std::string>& env = std::vector<std::string>(),
62 bool wait = true) const;
63
64 bool restart(const std::string& name,
65 const std::vector<std::string>& env = std::vector<std::string>(),
66 bool wait = true) const;
67
68 bool stop(const std::string& name,
69 bool wait = true) const;
70
71private:
72 bool invokeMethod(const std::string& method,
73 const std::string& name,
74 const std::vector<std::string>& env,
75 bool wait) const;
76
77private:
78 const std::shared_ptr<AI_IPC::IIpcService>& mIpcService;
79 const std::string mService;
80 const std::string mInterface;
81};
82
83#endif // !defined(UPSTART_H)
Wrapper for the upstart-dbus-bridge interface that allows starting and stopping system services.
Definition Upstart.h:54
bool stop(const std::string &name, bool wait=true) const
Attempts to stop the service with the given name.
Definition Upstart.cpp:215
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.
Definition Upstart.cpp:56
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.
Definition Upstart.cpp:187
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.
Definition Upstart.cpp:154