use English;
use JSON::XS;
-my $dir = '/srv/cloudstore/var';
-my $log_fifo = "$dir/rsyncd.log";
-my $pid_file = "$dir/rsyncd.pid";
-my $cfg_file = "$dir/rsyncd.conf";
-my $users = "users";
+my $dir = $ENV{RSYNC_DIR} || '/srv/cloudstore/var';
+my $port = $ENV{RSYNC_PORT} || 6501;
+my $users = "users";
+
+my $log_fifo = "$dir/$port.log";
+my $pid_file = "$dir/$port.pid";
+my $cfg_file = "$dir/$port.conf";
my @transfer = qw(
timestamp:%t:timestamp
login:%u:text
+port:$port:int
pid:%p:int
perms:%B:text
itemize:%i:text
file:%f:text
);
+$transfer[2] = "port:$port:int"; # expand $port
+
my @transfer_names = map { ( split(/:/,$_,3) )[0] } @transfer;
my $transfer_log = join(' ',map { ( split(/:/,$_,3) )[1] } @transfer );
}
if ( ! -e $pid_file ) {
- my $exec = "rsync --daemon --config $cfg_file --no-detach --port=6501";
+ my $exec = "rsync --daemon --config $cfg_file --no-detach --port=$port";
warn "START $exec\n";
die "could not fork\n" unless defined(my $pid = fork);