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
eec6b0d0
Commit
eec6b0d0
authored
Sep 28, 2012
by
Nigel Kukard
Browse files
Use default config file /etc/dbackup.conf
parent
5e51cf40
Changes
1
Hide whitespace changes
Inline
Side-by-side
dbackup
View file @
eec6b0d0
...
...
@@ -160,6 +160,16 @@ if (defined($optctl{'backup'}) && defined($optctl{'restore'})) {
exit
1
;
}
# Check config file exists
if
(
!
defined
(
$optctl
{'
config
'}))
{
$optctl
{'
config
'}
=
"
/etc/dbackupc.conf
";
}
if
(
!
-
f
$optctl
{'
config
'})
{
print
(
STDERR
"
ERROR: Configuration file '
"
.
$optctl
{'
config
'}
.
"
' NOT found!
\n
");
exit
1
;
}
# Make sure we only have 2 additional args
if
(
@ARGV
>
2
||
@ARGV
<
2
)
{
print
(
STDERR
"
ERROR: Invalid number of arguments
\n\n
");
...
...
@@ -177,25 +187,17 @@ if (! -d $ARGV[1]) {
exit
1
;
}
# Check config file exists
if
(
defined
(
$optctl
{'
config
'}))
{
if
(
!
-
f
$optctl
{'
config
'})
{
print
(
STDERR
"
ERROR: Configuration file '
"
.
$optctl
{'
config
'}
.
"
' NOT found!
\n
");
exit
1
;
}
# Use config file, ignore case
tie
my
%inifile
,
'
Config::IniFiles
',
(
-
file
=>
$optctl
{'
config
'},
-
nocase
=>
1
)
or
die
"
Failed to open config file '
"
.
$optctl
{'
config
'}
.
"
':
"
.
join
("
\n
",
@
Config::IniFiles::
errors
);
# Check if we actually have something...
if
(
defined
(
$inifile
{'
backup
'}))
{
# Loop with config items
foreach
my
$item
(
keys
%
{
$inifile
{'
backup
'}})
{
$config
{
$item
}
=
$inifile
{'
backup
'}{
$item
};
}
# Use config file, ignore case
tie
my
%inifile
,
'
Config::IniFiles
',
(
-
file
=>
$optctl
{'
config
'},
-
nocase
=>
1
)
or
die
"
Failed to open config file '
"
.
$optctl
{'
config
'}
.
"
':
"
.
join
("
\n
",
@
Config::IniFiles::
errors
);
# Check if we actually have something...
if
(
defined
(
$inifile
{'
backup
'}))
{
# Loop with config items
foreach
my
$item
(
keys
%
{
$inifile
{'
backup
'}})
{
$config
{
$item
}
=
$inifile
{'
backup
'}{
$item
};
}
}
...
...
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