]>
Commit | Line | Data |
---|---|---|
6a672919 DM |
1 | #!/usr/bin/perl -T |
2 | ||
3 | $ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin'; | |
4 | ||
5 | delete @ENV{qw(IFS CDPATH ENV BASH_ENV)}; | |
6 | ||
7 | use strict; | |
8 | use warnings; | |
9 | ||
10 | use PVE::SafeSyslog; | |
11 | use PVE::INotify; | |
12 | use PVE::RESTEnvironment; | |
13 | ||
14 | use PMG::Utils; | |
15 | use PMG::Config; | |
16 | use PMG::ClusterConfig; | |
17 | use PMG::LDAPSet; | |
3d511edd DM |
18 | use PMG::DBTools; |
19 | use PMG::Statistic; | |
6a672919 DM |
20 | |
21 | $SIG{'__WARN__'} = sub { | |
22 | my $err = $@; | |
23 | my $t = $_[0]; | |
24 | chomp $t; | |
25 | print STDERR "$t\n"; | |
26 | syslog('warning', "%s", $t); | |
27 | $@ = $err; | |
28 | }; | |
29 | ||
30 | PVE::RESTEnvironment->setup_default_cli_env(); | |
31 | ||
461cb046 | 32 | initlog('pmg-hourly', 'mail'); |
6a672919 DM |
33 | |
34 | my $cfg = PMG::Config->new(); | |
35 | ||
36 | my $demo = $cfg->get('admin', 'demo'); | |
37 | ||
3d511edd | 38 | my $cinfo = PMG::ClusterConfig->new(); |
6a672919 DM |
39 | |
40 | if ($demo) { | |
41 | # fixme: generate fake statistics | |
42 | ||
43 | return; | |
44 | } | |
3d511edd | 45 | |
f6884917 | 46 | PMG::Utils::service_cmd('pmgpolicy', 'reload-or-restart'); |
6a672919 DM |
47 | |
48 | my $ldap_cfg = PVE::INotify::read_file("pmg-ldap.conf"); | |
49 | PMG::LDAPSet::ldap_resync($ldap_cfg); | |
50 | ||
51 | # sync bayes journal to database | |
52 | system('sa-learn --sync >/dev/null 2>&1'); | |
53 | ||
54 | # make sure clamav-daemon is running | |
55 | PMG::Utils::service_cmd('clamav-daemon', 'start'); | |
56 | ||
57 | exit(0); | |
58 |