Skip to content

Commit

Permalink
Monitor proftpd to ensure it comes up correctly on system starts.
Browse files Browse the repository at this point in the history
Signed-off-by: Volker Theile <votdev@gmx.de>
  • Loading branch information
votdev committed Dec 5, 2019
1 parent f6b5c6b commit 6e544c6
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 2 deletions.
1 change: 1 addition & 0 deletions deb/openmediavault/debian/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ openmediavault (5.1.3-1) unstable; urgency=low

* Change OMV_SAMBA_FRUIT_MODEL default value to 'Xserve'.
* Fix bug in SMB recycle bin cleanup script.
* Monitor proftpd to ensure it comes up correctly on system starts.

-- Volker Theile <volker.theile@openmediavault.org> Tue, 03 Dec 2019 23:18:08 +0100

Expand Down
2 changes: 1 addition & 1 deletion deb/openmediavault/debian/openmediavault.postinst
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ case "$1" in
# Deploy collectd - uptime plugin has been added.
omv-salt deploy run --quiet collectd
fi
if dpkg --compare-versions "$2" lt-nl "5.1.2"; then
if dpkg --compare-versions "$2" lt-nl "5.1.3"; then
omv-salt deploy run --quiet monit
fi

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# - Use the sysV init script here instead of the systemd unit file.
# - Use 'restart' to start the daemon, thus the sysV init script takes
# care about the PID file which seems not to be cleaned up correctly.
check process proftpd with pidfile /var/run/proftpd.pid
start program = "/etc/init.d/proftpd restart"
stop program = "/etc/init.d/proftpd stop"
mode active
if failed port {{ proftpd_config.port }} protocol ftp for 3 cycles then restart
{%- if email_config.enable | to_bool and not notification_config.enable | to_bool %}
noalert {{ email_config.primaryemail }}
{%- endif %}
49 changes: 49 additions & 0 deletions deb/openmediavault/srv/salt/omv/deploy/monit/services/proftpd.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# This file is part of OpenMediaVault.
#
# @license http://www.gnu.org/licenses/gpl.html GPL Version 3
# @author Volker Theile <volker.theile@openmediavault.org>
# @copyright Copyright (c) 2009-2019 Volker Theile
#
# OpenMediaVault is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# any later version.
#
# OpenMediaVault is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenMediaVault. If not, see <http://www.gnu.org/licenses/>.

{% set proftpd_config = salt['omv_conf.get']('conf.service.ftp') %}

{% if proftpd_config.enable | to_bool %}

{% set email_config = salt['omv_conf.get']('conf.system.notification.email') %}
{% set notification_config = salt['omv_conf.get_by_filter'](
'conf.system.notification.notification',
{'operator': 'stringEquals', 'arg0': 'id', 'arg1': 'monitprocevents'})[0] %}

configure_monit_proftpd_service:
file.managed:
- name: "/etc/monit/conf.d/openmediavault-proftpd.conf"
- source:
- salt://{{ slspath }}/files/proftpd.j2
- template: jinja
- context:
proftpd_config: {{ proftpd_config | json }}
email_config: {{ email_config | json }}
notification_config: {{ notification_config | json }}
- user: root
- group: root
- mode: 644

{% else %}

remove_monit_proftpd_service:
file.absent:
- name: "/etc/monit/conf.d/openmediavault-proftpd.conf"

{% endif %}
12 changes: 12 additions & 0 deletions deb/openmediavault/srv/salt/omv/deploy/proftpd/default.sls
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,23 @@ start_proftpd_service:
- require:
- cmd: test_proftpd_service_config

monitor_proftpd_service:
module.run:
- name: monit.monitor
- m_name: proftpd
- require:
- service: start_proftpd_service

{% else %}

start_proftpd_service:
test.nop

unmonitor_proftpd_service:
module.run:
- name: monit.unmonitor
- m_name: proftpd

stop_proftpd_service:
service.dead:
- name: proftpd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class Proftpd extends \OMV\Engine\Module\ServiceAbstract implements
}

public function deployAfter(): array {
return ["certificates"];
return ["certificates", "monit"];
}

public function getStatus() {
Expand Down

0 comments on commit 6e544c6

Please sign in to comment.