Last active
May 6, 2019 15:46
-
-
Save korjavin/4737335 to your computer and use it in GitHub Desktop.
perl reload
This file contains 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
> perl reload.pl master! | |
router1 | |
router1 | |
router1 | |
router1 | |
router1 | |
sig | |
$DB_USER = 'router1'; | |
router1 | |
router1 | |
router1 | |
router1 | |
router1 | |
sig | |
$DB_USER = 'router2'; | |
router1 | |
router1 | |
router1 | |
router1 | |
router1 | |
^C |
This file contains 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
package MyConfig; | |
use strict; | |
use base 'Exporter'; | |
BEGIN { | |
our @EXPORT = qw($DB_USER ); | |
} | |
our @EXPORT; | |
use vars @EXPORT; | |
$DB_USER = 'router2'; |
This file contains 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 -w | |
use MyConfig; | |
$SIG{ALRM} = sub { delete $INC{"MyConfig.pm"}; require MyConfig; MyConfig->import;alarm 5 ; print "sig \n"; }; | |
alarm 5; | |
my $j=0; | |
while (1) { | |
print $DB_USER, "\n"; | |
sleep 1; | |
print `cat ./MyConfig.pm | grep 'DB_USER = '` if ((++$j)%5==0); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment