Last active
February 13, 2018 02:07
-
-
Save nuxwin/a5e77ca0383bf30d3e7c29bfd25ba784 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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