Handle hostnames with upper-case letters
[webmin.git] / status / proftpd-monitor.pl
1 # proftpd-monitor.pl
2 # Monitor the ProFTPD server on this host
3
4 # Check the PID file to see if proftpd is running
5 sub get_proftpd_status
6 {
7 return { 'up' => -1 } if (!&foreign_check($_[1]));
8 local %pconfig = &foreign_config($_[1]);
9 -r $pconfig{'proftpd_path'} || return { 'up' => -1 };
10 &foreign_require($_[1], "proftpd-lib.pl");
11 local $r = &foreign_call($_[1], "is_proftpd_running");
12 if ($r < 0) {
13         return { 'up' => -1 };
14         }
15 elsif ($r > 0) {
16         return { 'up' => 1 };
17         }
18 else {
19         return { 'up' => 0 };
20         }
21 }
22
23 sub parse_proftpd_dialog
24 {
25 &error($text{'proftpd_etype'}) if (&run_from_inetd());
26 }
27
28 sub run_from_inetd
29 {
30 local $m = $_[0]->{'clone'} || "proftpd";
31 &foreign_require($m, "proftpd-lib.pl");
32 local $conf = &foreign_call($m, "get_config");
33 local $st = &foreign_call($m, "find_directive", "ServerType", $conf);
34 return lc($st) eq 'inetd';
35 }
36
37 1;
38