Gitlab Community Edition Instance
Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bnachtw
dsmci
Commits
5ca3d20c
Commit
5ca3d20c
authored
Dec 20, 2019
by
bnachtw
Browse files
0.6.6 changed form of path arrays to path
parent
59ecc7f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
perl/dsmci.pl
View file @
5ca3d20c
...
...
@@ -54,6 +54,9 @@
# 2019-11-26 0.6.5.1 added some return codes
# 2019-11-29 0.6.5.2 added a new sequence for escaping "[" and "]" -- patch distributed by Salvatore again
# 2019-12-06 0.6.5.3 removed used sub "array_minus"
# 2019-12-06 0.6.6 changed form of path arrays to "path;SU-switch":
# removing @sund, @suyd, replaced by @allpaths
# 2019-12-10 0.6.6.1 add the number of threads to top of ".all.log" file
#
# important notes
#
...
...
@@ -150,8 +153,9 @@ my $val; # value part of commandline arguments
my
$item
=
undef
;
# running variable
my
$line
=
undef
;
# another running variable
my
$tline
=
undef
;
# another running temporary variable
my
@sund
=
undef
;
# array for all folders below $startpath to be processed with "su=n"
my
@suyd
=
undef
;
# array for all folders below $startpath to be processed with "su=y"
# my @sund = undef; # array for all folders below $startpath to be processed with "su=n"
# my @suyd = undef; # array for all folders below $startpath to be processed with "su=y"
my
@allpaths
=
undef
;
# array for all folders below $startpath to be processed
my
@tdirs
=
undef
;
# temporary array for all folders below $startpath
my
$dir
=
undef
;
# running variable
my
$numdir
=
undef
;
# number of dirs to be processed
...
...
@@ -334,19 +338,29 @@ foreach $actpath (@startpaths)
$rule
->
mindepth
(
$maxdepth
);
$rule
->
not
(
$rule
->
new
->
symlink
);
my
@tsuyd
=
$rule
->
in
(
$actpath
);
push
@suyd
,
@tsuyd
;
# add to global list
# add su=y information to each path entry
foreach
$item
(
@tsuyd
)
{
$line
=
sprintf
"
%s;Y
",
$item
;
push
@allpaths
,
$line
;
}
$rule
->
directory
;
$rule
->
maxdepth
(
$depth
);
$rule
->
mindepth
(
0
);
$rule
->
not
(
$rule
->
new
->
symlink
);
my
@tsund
=
$rule
->
in
(
$actpath
);
push
@sund
,
@tsund
;
# add to global list
# add su=y information to each path entry
foreach
$item
(
@tsund
)
{
$line
=
sprintf
"
%s;N
",
$item
;
push
@allpaths
,
$line
;
}
}
# remove empty top element
shift
@sund
;
shift
@suyd
;
shift
@allpaths
;
###############################################################################
# read profiling
...
...
@@ -368,18 +382,14 @@ $proffilename = File::Spec->canonpath("dsmci".$profapx);
# start loop on all folders
#
$threads
=
0
;
# reset number of child threads to zero
$numdir
=
(
scalar
@
sund
)
+
(
scalar
@suyd
);
# number of dirs to be processed
$numdir
=
(
scalar
@
allpaths
);
$dircount
=
0
;
# counter of dirs already processed
# set switcher to "Y"
@switcher
=
('
Y
');
fork_backup_threads
(
\
@switcher
,
\
@suyd
);
## and now backing up the upper paths without subdirs / with "su=no"
# set switcher to "N"
@switcher
=
('
N
');
fork_backup_threads
(
\
@switcher
,
\
@sund
);
# write number of threads to global logfile
open
$GLOBALLOGFILE
,
"
>>
",
$globallog_filename
;
printf
$GLOBALLOGFILE
"
Number of Threads: %d
\n\n
",
$numdir
;
close
$GLOBALLOGFILE
;
fork_backup_threads
(
\
@allpaths
);
# wait for all child threads exiting
wait_for_threads
();
...
...
@@ -697,15 +707,32 @@ sub in_array
}
return
FALSE
;
}
# look up if a given string is already stored in an array, where each array item consists of two parts seperated by ";"
sub
in_array1
{
my
(
$sstring
,
@array
)
=
@_
;
# input: string and array
my
$argi1
;
# first element of string given in array @array
foreach
my
$argi
(
@array
)
{
(
$argi1
,
undef
)
=
split
'
;
',
$argi
;
# devide array item in both parts
if
(
$argi1
eq
$sstring
)
# compare first part with given string
{
return
TRUE
;
}
}
return
FALSE
;
}
# collocate both loops in one subroutine
sub
fork_backup_threads
{
my
(
$one_ref
,
$two_ref
)
=
@_
;
my
$switcher
=
@
{
$one_ref
}[
0
];
# dereferencing and copying each array
my
@larray
=
@
{
$two_ref
};
# dereferencing and copying each array
foreach
$actpath
(
@larray
)
my
$switcher
;
foreach
$item
(
@allpaths
)
{
# split path and SU-switcher
(
$actpath
,
$switcher
)
=
split
'
;
',
$item
;
# all threads already running ??
if
(
$threads
<
$maxthreads
)
{
# NO, they don't
...
...
@@ -748,7 +775,7 @@ sub fork_backup_threads
# backup commandline
$command
=
"
\"
$dsmcbin
\"
i
\"
$dir
\"
-optfile=
\"
$optfile
\"
-su=
$switcher
>>
$log_filename
2>&1
";
#printf "%s\n", $command;
# record commandline in childlogfile
open
$CHILDLOGFILE
,
"
>
",
$log_filename
;
printf
$CHILDLOGFILE
"
CMD: >>%s<<
\n\n
",
$command
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment