mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
dns/ddclient: handle pidfile correctly on different backend
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user