dns/ddclient: handle pidfile correctly on different backend

This commit is contained in:
Franco Fichtner
2023-04-21 10:11:27 +02:00
parent 94d04f74c8
commit f920b48a94
3 changed files with 22 additions and 17 deletions
+1
View File
@@ -1,5 +1,6 @@
PLUGIN_NAME= ddclient
PLUGIN_VERSION= 1.12
PLUGIN_REVISION= 1
PLUGIN_DEPENDS= ddclient-devel
PLUGIN_COMMENT= Dynamic DNS client
PLUGIN_MAINTAINER= ad@opnsense.org
@@ -30,39 +30,46 @@
function ddclient_services()
{
$services = [];
$mdl = new \OPNsense\DynDNS\DynDNS();
if ($mdl->general->enabled == '1') {
$services[] = [
$service = [
'description' => gettext('ddclient'),
'configd' => [
'restart' => array('ddclient restart'),
'start' => array('ddclient start'),
'stop' => array('ddclient stop'),
'restart' => ['ddclient restart'],
'start' => ['ddclient start'],
'stop' => ['ddclient stop'],
],
'name' => 'ddclient',
'pidfile' => '/var/run/ddclient.pid',
];
$service['pidfile'] = (string)$mdl->general->backend != 'opnsense' ? '/var/run/ddclient.pid' : '/var/run/ddclient_opn.pid';
$services[] = $service;
}
return $services;
}
function ddclient_xmlrpc_sync()
{
$result = array();
$result[] = array(
$result = [];
$result[] = [
'description' => gettext('ddclient'),
'section' => 'OPNsense.DynDNS',
'id' => 'ddclient',
'services' => ['ddclient'],
);
'id' => 'ddclient',
];
return $result;
}
function ddclient_syslog()
{
$logfacilities = array();
$logfacilities['ddclient'] = array(
'facility' => ['ddclient']
);
$logfacilities = [];
$logfacilities['ddclient'] = [
'facility' => ['ddclient'],
];
return $logfacilities;
}
@@ -12,10 +12,7 @@ type:script
message:stopping ddclient
[status]
command:
pgrep -qF /var/run/ddclient.pid 2> /dev/null && echo "ddclient is running" ||
pgrep -qF /var/run/ddclient_opn.pid 2> /dev/null && echo "ddclient is running" ||
echo "ddclient is not running"
command:/usr/local/sbin/pluginctl -s ddclient status
type:script_output
message:get ddclient status