darshan-mk-log-dirs.pl.in 992 Bytes
Newer Older
1
#!/usr/bin/perl -w
2
#
Shane Snyder's avatar
Shane Snyder committed
3
4
# Copyright (C) 2015 University of Chicago.
# See COPYRIGHT notice in top-level directory.
5
6
#

7
8
use File::Basename;

9
10
# creates a hierarchy of subdirectories for darshan to place log files in
# LOGDIR/<year>/<month>/<day>/
11
12

# use log dir specified at configure time
13
$LOGDIR = "@__DARSHAN_LOG_PATH@";
14
15
16
17


my $year = (localtime)[5] + 1900;
my $month;
18
my $day;
19
20
my $i;
my $j;
21
my $k;
22
23
24

umask(0);

25
26
# go through the end of next year
for ($i=$year; $i<($year+2); $i++)
27
{
28
29
30
31
32
33
    if(!mkdir("$LOGDIR/$i", 0755))
    {
        print STDERR "Error: mkdir($LOGDIR/$i): $!.\n";
        print STDERR "Error: please make sure that the $LOGDIR directory already exists and is writeable.\n";
        exit(1);
    }
34
35
    for ($j=1; $j<13; $j++)
    {
36
37
        mkdir("$LOGDIR/$i/$j", 0755) or die("Error: could not mkdir $LOGDIR/$i/$j.\n");
        for ($k=1; $k<32; $k++)
38
        {
39
            mkdir("$LOGDIR/$i/$j/$k", 01777) or die("Error: could not mkdir $LOGDIR/$i/$j/$k.\n");
40

41
        }
42
43
44
    }
}

45