'start', 'stop'=>'stop', 'status'=>'status', 'restart'=>'restart', 'reload'=>'reload', 'enable'=>'enable', 'disable'=>'disable', default=>'restart', }; } private static function get_valid_action_for_system_ctl(string $action): string|false { return match($action) { 'list'=>'--list', 'on'=>'on', 'off'=>'off', default=>'on', }; } public static function service(string $name, string $action = 'restart') { $my_action = get_valid_action_for_service($action); exec(\neato::get_super_user_bin . '/etc/init.d/' . safe_cmd($name, $my_action), $output, $exit_code); display($output); check_for_error($exit_code, "Unable to {$action} Service called: {$name}"); return $exit_code; } public static function systemctl(string $name, string $action = 'on') { $my_action = get_valid_action_for_system_ctl($action); exec(\neato::get_bin . 'chkconfig ' . safe_cmd($action, $name), $output, $exit_code); check_for_error($exit_code, "Unable to {$action} Service called: {$name}"); return $exit_code; } }