/** * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ namespace Yggtk { public class YggdrasilServiceSystemd : Object, YggdrasilService { public bool get_status () throws SpawnError { string cmd_stdout; int cmd_status = -1; Process.spawn_command_line_sync ("systemctl status yggdrasil", out cmd_stdout, null, out cmd_status); if (cmd_status == 0 && cmd_stdout.contains ("active (running)")) { return true; } return false; } public void start () throws SpawnError { Process.spawn_command_line_sync ("pkexec systemctl start yggdrasil"); } public void stop () throws SpawnError { Process.spawn_command_line_sync ("pkexec systemctl stop yggdrasil"); } } }