This file is indexed.

/usr/lib/oar/oaraccounting is in oar-server 2.5.7-3.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/perl
# $Id$

use strict;
use warnings;
use Data::Dumper;
use OAR::IO;
use OAR::Conf qw(init_conf dump_conf get_conf is_conf);
use Getopt::Long;
use OAR::Version;

my $Old_umask = sprintf("%lo",umask());
umask(oct("022"));

Getopt::Long::Configure ("gnu_getopt");
my $Version;
my $Help;
my $Delete_windows_before;
my $Reinitialize;
GetOptions (
    "reinitialize" => \$Reinitialize,
    "delete-before=i" => \$Delete_windows_before,
    "help|h" => \$Help,
    "version|V" => \$Version
           ) or exit(1);
if (defined($Version)){
    print("OAR version : ".OAR::Version::get_version()."\n") ;
    exit(0);
}

if (defined($Help)){
     print <<EOS;
Usage: $0 [-h] [-V] [--reinitialize | --delete_before]
Feed accounting table to make usage statistics.
Options:
      --reinitialize
                delete everything and recheck every jobs and feed the table
      --delete-before=<number_of_seconds>
                delete every records number_of_seconds ago
  -h, --help    show this help screen
  -V, --version print OAR version number
EOS
    exit(0);
}

# Default window size
my $windowSize = 86400;
init_conf($ENV{OARCONFFILE});
if (is_conf("ACCOUNTING_WINDOW")){
    $windowSize = get_conf("ACCOUNTING_WINDOW");
}

my $base = OAR::IO::connect_one();
if (not defined($base)) {
    warn "Error: Failed to connect to database\n";
    exit 1;
}

my $lockName = "ACCOUNTING";
OAR::IO::get_lock($base,$lockName,3600); # Only for mysql
if (OAR::IO::get_database_type() eq "Pg"){
    OAR::IO::lock_table($base, ["accounting"]); # begin transaction
    $base->do("LOCK TABLE accounting IN EXCLUSIVE MODE");
}
if (defined($Reinitialize)){
    print("Deleting all records from the acounting table...\n");
    OAR::IO::delete_all_from_accounting($base);
}elsif (defined($Delete_windows_before)){
    print("Deleting records older than $Delete_windows_before seconds ago...\n");
    $Delete_windows_before = OAR::IO::get_date($base) - $Delete_windows_before;
    OAR::IO::delete_accounting_windows_before($base,$Delete_windows_before);
}else{
    OAR::IO::check_accounting_update($base,$windowSize);
}
OAR::IO::unlock_table($base) if (OAR::IO::get_database_type() eq "Pg");
OAR::IO::release_lock($base,$lockName);

OAR::IO::disconnect($base);

exit 0;