Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
awit-dbackup
awit-dbackup
Commits
6668851d
Commit
6668851d
authored
Dec 24, 2014
by
Nigel Kukard
Browse files
Added a delay before termination of 2 seconds
This will help in future when we need to do cleanups
parent
1a3e5512
Changes
1
Hide whitespace changes
Inline
Side-by-side
dbackup
View file @
6668851d
...
...
@@ -1066,30 +1066,6 @@ sub backup
# If we backing up or restoring, we need to check the compression program
if
(
defined
(
$optctl
{'
backup
'})
||
defined
(
$optctl
{'
restore
'}))
{
# One last check for to make sure the compression program exists
if
(
checkPATH
(
my
$compressProgram
=
"
compress-
"
.
$config
{'
compress
'}))
{
print
(
STDERR
"
ERROR: Compression program '
$compressProgram
' cannot be found in path!
");
exit
1
;
}
}
# Check if we backing up
if
(
defined
(
$optctl
{'
backup
'}))
{
backup
(
$sourceDir
,
$destDir
);
# Or restoring...
}
elsif
(
defined
(
$optctl
{'
restore
'}))
{
restore
(
$sourceDir
,
$destDir
);
}
else
{
print
(
STDERR
"
ERROR: No command given
\n\n
");
displayHelp
();
exit
1
;
}
# Restore function
sub
restore
{
...
...
@@ -1615,4 +1591,45 @@ sub checkPATH
}
# Function to handle SIGINT
sub sigINT_handler
{
print(STDERR "Caught SIGINT! ... terminating");
sleep(2);
exit 1;
}
# If we backing up or restoring, we need to check the compression program
if (defined($optctl{
'
backup
'
}) || defined($optctl{
'
restore
'
})) {
# One last check for to make sure the compression program exists
if (checkPATH(my $compressProgram = "compress-".$config{
'
compress
'
})) {
print(STDERR "ERROR: Compression program
'
$compressProgram
'
cannot be found in path!");
exit 1;
}
}
# Install our int handler
$SIG{INT} = \&sigINT_handler;
# Check if we backing up
if (defined($optctl{
'
backup
'
})) {
backup($sourceDir,$destDir);
# Or restoring...
} elsif (defined($optctl{
'
restore
'
})) {
restore($sourceDir,$destDir);
} else {
print(STDERR "ERROR: No command given\n\n");
displayHelp();
exit 1;
}
# vim: ts=4
Write
Preview
Supports
Markdown
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