From cf1f4e00b9a85332a4bd71604aa6086bc8ad3b91 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Tue, 22 Sep 2020 14:40:21 +0200 Subject: [PATCH] rc: support id in pluginctl -s mode PR: https://forum.opnsense.org/index.php?topic=19240.0 --- src/sbin/pluginctl | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/sbin/pluginctl b/src/sbin/pluginctl index 121ee82b1..885e3cc4f 100755 --- a/src/sbin/pluginctl +++ b/src/sbin/pluginctl @@ -3,7 +3,7 @@ /* * Copyright (C) 2019 Deciso B.V. - * Copyright (C) 2019 Franco Fichtner + * Copyright (C) 2019-2020 Franco Fichtner * Copyright (C) 2017 Alexander Shursha * All rights reserved. * @@ -62,7 +62,6 @@ function get_config_prop($path, $cnf=null) } } - $opts = getopt('cshrg', array(), $optind); $args = array_slice($argv, $optind); @@ -108,15 +107,19 @@ if (isset($opts['h'])) { } elseif (isset($opts['s'])) { $name = !empty($args[0]) ? $args[0] : ''; $act = !empty($args[1]) ? $args[1] : ''; + $filter = []; + if (!empty($args[2])) { + $filter['id'] = $args[2]; + } switch ($act) { case 'start': - echo service_control_start($name, array()) . PHP_EOL; + echo service_control_start($name, $filter) . PHP_EOL; break; case 'stop': - echo service_control_stop($name, array()) . PHP_EOL; + echo service_control_stop($name, $filter) . PHP_EOL; break; case 'restart': - echo service_control_restart($name, array()) . PHP_EOL; + echo service_control_restart($name, $filter) . PHP_EOL; break; default: echo "Unknown command `$act'\n";