explode if $run_dir is not specified; make a config setting and perhaps shift the onus onto the user rather than having to deal with tmpfiles.d etc

See: https://github.com/postfixadmin/postfixadmin/issues/78
pull/298/head
David Goodwin 5 years ago
parent 80418e6412
commit f8713651cc

@ -26,6 +26,9 @@ our $db_username="mail";
# database password
our $db_password="CHANGE_ME!";
# Where to create a lockfile; please ensure path exists.
our $run_dir="/var/run/fetchmail";
# instead of changing this script, you can put your settings to /etc/mail/postfixadmin/fetchmail.conf
# just use perl syntax there to fill the variables listed above (without the "our" keyword). Example:
# $db_username = 'mail';
@ -40,7 +43,7 @@ if (-f "/etc/mail/postfixadmin/fetchmail.conf") {
openlog("fetchmail-all", "pid", "mail");
sub log_and_die {
my($message) = @_;
my($message) = @_;
syslog("err", $message);
die $message;
}
@ -59,8 +62,6 @@ while ($_ = shift @ARGS1) {
}
}
$run_dir="/var/run/fetchmail";
# use specified config file
if (-e $configfile) {
do $configfile;
@ -72,6 +73,10 @@ if($db_type eq "Pg" || $db_type eq "mysql") {
log_and_die "unsupported db_type $db_type";
}
if(!-d $run_dir) {
log_and_die("Please create: $run_dir");
}
$lock_file=$run_dir . "/fetchmail-all.lock";
$lockmgr = LockFile::Simple->make(-autoclean => 1, -max => 1);

Loading…
Cancel
Save