Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/perl
# Make it possible to test the i-MSCP iMSCP::Listener::Postfix::Rspamd listener
# file by triggering the afterMtaBuildConf event manually.
#
# How to process:
# - Install the listener file that you can find at https://gist.github.com/nuxwin/3a855ecbaae7d2482b68126e8206c534
# under the /etc/imscp/listeners.d directory, e.g: /etc/imscp/listeners.d/10_postfix_rspamd.pl
# - Download that script under the /usr/local/src directory with name imscp_test_rspamd_listener.pl
# - Run the script as follows: perl /usr/local/src/imscp_test_rspamd_listener.pl
# - Check that values from your /etc/postfix/main.cf file were updated as expected.
use strict;
use warnings;
use lib '/var/www/imscp/engine/PerlLib', '/var/www/imscp/engine/PerlVendor';
use iMSCP::Bootstrapper;
use iMSCP::Debug;
use iMSCP::EventManager;
$main::execmode = 'setup' unless defined $main::execmode;
my $bootstrapper = iMSCP::Bootstrapper->getInstance();
exit unless $bootstrapper->lock( '/var/lock/imscp_test_rspamd_listener.lock', 'nowait' );
$bootstrapper->boot(
{
mode => 'setup',
nolock => 1,
config_readonly => 1
}
);
setDebug( 1 );
setVerbose( 1 );
# Trigger the afterMtaBuildConf event manually.
# Postfix configuration should be automagically reloaded.
iMSCP::EventManager->getInstance()->trigger( 'afterMtaBuildConf' );
1;
__END__
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.