View | Details | Raw Unified | Return to bug 15529
Collapse All | Expand All

(-)a/Makefile.PL (+7 lines)
Lines 220-225 Directory for Zebra's lock files. This includes subdirs for authorities, Link Here
220
biblios, and the zebra rebuild function.  Any activity to reindex
220
biblios, and the zebra rebuild function.  Any activity to reindex
221
zebra from koha should interlock here with rebuild_zebra.pl.
221
zebra from koha should interlock here with rebuild_zebra.pl.
222
222
223
=item CRON_LOCK_DIR
224
225
Directory for cronjob lock files.
226
223
=item ZEBRA_DATA_DIR
227
=item ZEBRA_DATA_DIR
224
228
225
Directory for Zebra's data files.
229
Directory for Zebra's data files.
Lines 358-363 my $target_map = { Link Here
358
  './skel/var/lib/koha/zebradb/biblios/register'  => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
362
  './skel/var/lib/koha/zebradb/biblios/register'  => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
359
  './skel/var/lib/koha/zebradb/biblios/shadow'  => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
363
  './skel/var/lib/koha/zebradb/biblios/shadow'  => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
360
  './skel/var/lib/koha/zebradb/biblios/tmp'  => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
364
  './skel/var/lib/koha/zebradb/biblios/tmp'  => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
365
  './skel/var/lock/koha/cron' => { target => 'CRON_LOCK_DIR', trimdir => 6 },
361
  './skel/var/lock/koha/zebradb/rebuild' => { target => 'ZEBRA_LOCK_DIR', trimdir => 6 },
366
  './skel/var/lock/koha/zebradb/rebuild' => { target => 'ZEBRA_LOCK_DIR', trimdir => 6 },
362
  './skel/var/lib/koha/plugins' => { target => 'PLUGINS_DIR', trimdir => 6 },
367
  './skel/var/lib/koha/plugins' => { target => 'PLUGINS_DIR', trimdir => 6 },
363
  './sms'                       => 'INTRANET_CGI_DIR',
368
  './sms'                       => 'INTRANET_CGI_DIR',
Lines 649-654 my %test_suite_override_dirs = ( Link Here
649
    BACKUP_DIR     => ['var', 'spool'],
654
    BACKUP_DIR     => ['var', 'spool'],
650
    SCRIPT_DIR     => ['bin'],
655
    SCRIPT_DIR     => ['bin'],
651
    ZEBRA_LOCK_DIR => ['var', 'lock', 'zebradb'],
656
    ZEBRA_LOCK_DIR => ['var', 'lock', 'zebradb'],
657
    CRON_LOCK_DIR  => ['var', 'lock', 'cron'],
652
    ZEBRA_DATA_DIR => ['var', 'lib', 'zebradb'],
658
    ZEBRA_DATA_DIR => ['var', 'lib', 'zebradb'],
653
    ZEBRA_RUN_DIR  => ['var', 'run', 'zebradb'],
659
    ZEBRA_RUN_DIR  => ['var', 'run', 'zebradb'],
654
);
660
);
Lines 1350-1355 sub get_target_directories { Link Here
1350
        $dirmap{'MAN_DIR'} = File::Spec->catdir(@basedir, $package, 'man');
1356
        $dirmap{'MAN_DIR'} = File::Spec->catdir(@basedir, $package, 'man');
1351
        $dirmap{'DOC_DIR'} = File::Spec->catdir(@basedir, $package, 'doc');
1357
        $dirmap{'DOC_DIR'} = File::Spec->catdir(@basedir, $package, 'doc');
1352
        $dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lock', 'zebradb');
1358
        $dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lock', 'zebradb');
1359
        $dirmap{'CRON_LOCK_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lock', 'cron');
1353
        $dirmap{'LOG_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'log');
1360
        $dirmap{'LOG_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'log');
1354
        $dirmap{'BACKUP_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'spool');
1361
        $dirmap{'BACKUP_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'spool');
1355
        $dirmap{'PLUGINS_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'lib', 'koha', 'plugins');
1362
        $dirmap{'PLUGINS_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'lib', 'koha', 'plugins');
(-)a/debian/templates/koha-conf-site.xml.in (+1 lines)
Lines 295-300 __END_SRU_PUBLICSERVER__ Link Here
295
 <useldapserver>0</useldapserver><!-- see C4::Auth_with_ldap for extra configs you must add if you want to turn this on -->
295
 <useldapserver>0</useldapserver><!-- see C4::Auth_with_ldap for extra configs you must add if you want to turn this on -->
296
 <useshibboleth>0</useshibboleth><!-- see C4::Auth_with_shibboleth for extra configs you must do to turn this on -->
296
 <useshibboleth>0</useshibboleth><!-- see C4::Auth_with_shibboleth for extra configs you must do to turn this on -->
297
 <zebra_lockdir>/var/lock/koha/__KOHASITE__</zebra_lockdir>
297
 <zebra_lockdir>/var/lock/koha/__KOHASITE__</zebra_lockdir>
298
 <cron_lockdir>/var/lock/koha/__KOHASITE__</cron_lockdir>
298
 <use_zebra_facets>1</use_zebra_facets>
299
 <use_zebra_facets>1</use_zebra_facets>
299
 <queryparser_config>/etc/koha/searchengine/queryparser.yaml</queryparser_config>
300
 <queryparser_config>/etc/koha/searchengine/queryparser.yaml</queryparser_config>
300
 <log4perl_conf>__KOHA_CONF_DIR__/log4perl.conf</log4perl_conf>
301
 <log4perl_conf>__KOHA_CONF_DIR__/log4perl.conf</log4perl_conf>
(-)a/etc/koha-conf.xml (+1 lines)
Lines 116-121 __PAZPAR2_TOGGLE_XML_POST__ Link Here
116
 <useldapserver>0</useldapserver><!-- see C4::Auth_with_ldap for extra configs you must add if you want to turn this on -->
116
 <useldapserver>0</useldapserver><!-- see C4::Auth_with_ldap for extra configs you must add if you want to turn this on -->
117
 <useshibboleth>0</useshibboleth><!-- see C4::Auth_with_shibboleth for extra configs you must do to turn this on -->
117
 <useshibboleth>0</useshibboleth><!-- see C4::Auth_with_shibboleth for extra configs you must do to turn this on -->
118
 <zebra_lockdir>__ZEBRA_LOCK_DIR__</zebra_lockdir>
118
 <zebra_lockdir>__ZEBRA_LOCK_DIR__</zebra_lockdir>
119
 <cron_lockdir>__CRON_LOCK_DIR__</cron_lockdir>
119
 <use_zebra_facets>1</use_zebra_facets>
120
 <use_zebra_facets>1</use_zebra_facets>
120
 <queryparser_config>__KOHA_CONF_DIR__/searchengine/queryparser.yaml</queryparser_config>
121
 <queryparser_config>__KOHA_CONF_DIR__/searchengine/queryparser.yaml</queryparser_config>
121
 <log4perl_conf>__KOHA_CONF_DIR__/log4perl.conf</log4perl_conf>
122
 <log4perl_conf>__KOHA_CONF_DIR__/log4perl.conf</log4perl_conf>
(-)a/misc/cronjobs/process_message_queue.pl (-7 / +35 lines)
Lines 29-34 use C4::Letters; Link Here
29
use C4::Log;
29
use C4::Log;
30
use Getopt::Long;
30
use Getopt::Long;
31
use C4::Context;
31
use C4::Context;
32
use File::Path;
33
34
use constant LOCK_FILENAME => 'message_queue..LCK';
32
35
33
my $username = undef;
36
my $username = undef;
34
my $password = undef;
37
my $password = undef;
Lines 37-46 my $method = 'LOGIN'; Link Here
37
my $help = 0;
40
my $help = 0;
38
my $verbose = 0;
41
my $verbose = 0;
39
my $type = q{};
42
my $type = q{};
43
my $use_flock;
40
44
41
use Fcntl ':flock';
45
use Fcntl ':flock';
42
46
43
44
GetOptions(
47
GetOptions(
45
    'u|username:s'      => \$username,
48
    'u|username:s'      => \$username,
46
    'p|password:s'      => \$password,
49
    'p|password:s'      => \$password,
Lines 80-95 die $usage if $help; Link Here
80
cronlogaction();
83
cronlogaction();
81
84
82
if ($verbose) { print "start of program\n"; }
85
if ($verbose) { print "start of program\n"; }
83
my $logdir = C4::Context->config('logdir');
84
86
85
chomp $logdir;
87
#Create a lock file in either in cron_lockdir (config line), a standard location (/var/lock/cron_<instance>) or /tmp/cron_<instance>)
86
my $instancemessagequeuefile = $logdir . "/messagequeue.lock";
88
my ($lockfile, $LockFH);
87
my $fh;
89
foreach (
88
open $fh, '>>', $instancemessagequeuefile or die "Cannot write to $instancemessagequeuefile: $!";
90
        C4::Context->config("cron_lockdir"),
91
        '/var/lock/cron_' . C4::Context->config('database'),
92
        '/tmp/cron_' . C4::Context->config('database')
93
) {
94
    next if !$_;
95
    ($LockFH, $lockfile) = _create_lockfile($_.'/message_queue');
96
    last if defined $LockFH;
97
}
98
if( !defined $LockFH ) {
99
        print "WARNING: Could not create lock file $lockfile: $!\n";
100
        print "Please check your koha-conf.xml for ZEBRA_LOCKDIR.\n";
101
        print "Verify file permissions for it too.\n";
102
        $use_flock = 0; # we disable file locking now and will continue
103
        # without it
104
        # note that this mimics old behavior (before we used
105
        # the lockfile)
106
};
89
107
90
my $letter_code = '';
108
my $letter_code = '';
91
if ($verbose) { print "Getting the lock\n"; }
109
if ($verbose) { print "Getting the lock\n"; }
92
unless (flock ( $fh, LOCK_EX|LOCK_NB )) {
110
unless (flock ( $LockFH, LOCK_EX|LOCK_NB )) {
93
111
94
    print STDERR "$0 is already running!\n";
112
    print STDERR "$0 is already running!\n";
95
    #If verbose is set send email to inform administrator another process_message_queue.pl cron was attempted to run whilst previous execution of the file is taking place.
113
    #If verbose is set send email to inform administrator another process_message_queue.pl cron was attempted to run whilst previous execution of the file is taking place.
Lines 127-129 if ($verbose) { Link Here
127
    sleep(15);
145
    sleep(15);
128
    print "End of process_message_queue.pl cron process";
146
    print "End of process_message_queue.pl cron process";
129
}
147
}
148
149
sub _create_lockfile { #returns undef on failure
150
    my $dir= shift;
151
    unless (-d $dir) {
152
        eval { mkpath($dir, 0, oct(755)) };
153
        return if $@;
154
    }
155
    return if !open my $fh, q{>}, $dir.'/'.LOCK_FILENAME;
156
    return ( $fh, $dir.'/'.LOCK_FILENAME );
157
}
(-)a/rewrite-config.PL (-1 / +1 lines)
Lines 124-129 $prefix = $ENV{'INSTALL_BASE'} || "/usr"; Link Here
124
  '__MAN_DIR__' => "$prefix/man",
124
  '__MAN_DIR__' => "$prefix/man",
125
  '__DOC_DIR__' => "$prefix/doc",
125
  '__DOC_DIR__' => "$prefix/doc",
126
  '__ZEBRA_LOCK_DIR__' => "$prefix/var/lock/zebradb",
126
  '__ZEBRA_LOCK_DIR__' => "$prefix/var/lock/zebradb",
127
  '__CRON_LOCK_DIR__' => "$prefix/var/lock/cron",
127
  '__ZEBRA_DATA_DIR__' => "$prefix/var/lib/zebradb",
128
  '__ZEBRA_DATA_DIR__' => "$prefix/var/lib/zebradb",
128
  '__ZEBRA_RUN_DIR__' => "$prefix/var/run/zebradb",
129
  '__ZEBRA_RUN_DIR__' => "$prefix/var/run/zebradb",
129
  '__ZEBRA_MARC_FORMAT__' => 'marc21',
130
  '__ZEBRA_MARC_FORMAT__' => 'marc21',
130
- 

Return to bug 15529