]>
git.proxmox.com Git - pmg-api.git/blob - bin/pmg-daily
3 $ENV{'PATH'} = '/sbin:/bin:/usr/sbin:/usr/bin';
5 delete @ENV{qw(IFS CDPATH ENV BASH_ENV)};
13 use PVE
::RESTEnvironment
;
17 use PMG
::ClusterConfig
;
20 $SIG{'__WARN__'} = sub {
25 syslog
('warning', "%s", $t);
29 PVE
::RESTEnvironment-
>setup_default_cli_env();
31 initlog
('pmg-daily', 'mail');
33 my $cfg = PMG
::Config-
>new();
35 if (my $statlifetime = $cfg->get ('admin', 'statlifetime')) {
38 my $dbh = PMG
::DBTools
::open_ruledb
();
39 $count = PMG
::DBTools
::purge_statistic_database
($dbh, $statlifetime);
44 syslog
('info', "cleanup removed $count entries from statistic database") if $count;
48 # fixme: check for available updates
50 # rotate razor log file
51 rename('/root/.razor/razor-agent.log', '/root/.razor/razor-agent.log.0');
53 # update spamassassin rules
54 if (system('sa-update') == 0) {
55 # if the exit code is 0, new updates were downloaded
56 # then restart the pmg-smtp-filter to load the new rules
57 PMG
::Utils
::service_cmd
('pmg-smtp-filter', 'restart');
60 # run bayes database maintainance
61 system('sa-learn --force-expire >/dev/null 2>&1');