added systemd service & timer
This commit is contained in:
parent
6fc85b8692
commit
94334694d4
|
@ -2,7 +2,7 @@
|
||||||
"name": "24unix/bindapi",
|
"name": "24unix/bindapi",
|
||||||
"description": "manage Bind9 DNS server via REST API",
|
"description": "manage Bind9 DNS server via REST API",
|
||||||
"version": "1.0.7",
|
"version": "1.0.7",
|
||||||
"build_number": "350",
|
"build_number": "351",
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Micha Espey",
|
"name": "Micha Espey",
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
Copy this files to /etc/systems/system, adapt the path in the service unit and enable the timer by issuing:
|
||||||
|
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl enable bindAPI.timer
|
||||||
|
systemctl start bindAPI.timer
|
||||||
|
systemctl list-timers
|
|
@ -0,0 +1,5 @@
|
||||||
|
[Unit]
|
||||||
|
Description=BindAPI Service to check zone file and reload configuration
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
ExecStart=/home/users/<user>/<bindApi>/bin/console cron:run -q
|
|
@ -0,0 +1,10 @@
|
||||||
|
[Unit]
|
||||||
|
Description=Runs BindAPI every minute
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnBootSec=1min
|
||||||
|
OnUnitActiveSec=1min
|
||||||
|
Unit=bindAPI.service
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
|
@ -94,7 +94,12 @@ class CLIController
|
||||||
$this->apikeysDelete();
|
$this->apikeysDelete();
|
||||||
},
|
},
|
||||||
mandatoryParameters: ['ID'])))
|
mandatoryParameters: ['ID'])))
|
||||||
|
->addCommandGroup(commandGroup: (new CommandGroup(name: 'cron', description: 'Run zone fle maintenance'))
|
||||||
|
->addCommand(command: new Command(
|
||||||
|
name: 'run',
|
||||||
|
callback: function () {
|
||||||
|
$this->cronRun();
|
||||||
|
})))
|
||||||
->addCommandGroup(commandGroup: (new CommandGroup(name: 'check', description: 'health checks the system can perform'))
|
->addCommandGroup(commandGroup: (new CommandGroup(name: 'check', description: 'health checks the system can perform'))
|
||||||
->addCommand(command: new Command(
|
->addCommand(command: new Command(
|
||||||
name: 'permissions',
|
name: 'permissions',
|
||||||
|
@ -2181,4 +2186,10 @@ class CLIController
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function cronRun()
|
||||||
|
{
|
||||||
|
$this->logger->debug(message: 'cronRun()');
|
||||||
|
$this->domainsUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue