Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
forge001
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gerhard Gonter
forge001
Commits
01f32cd6
Commit
01f32cd6
authored
10 years ago
by
Gerhard Gonter
Browse files
Options
Downloads
Patches
Plain Diff
copied from local script
parent
c340e39f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
simon/lib/SiMon/MySQL.pm
+71
-0
71 additions, 0 deletions
simon/lib/SiMon/MySQL.pm
with
71 additions
and
0 deletions
simon/lib/SiMon/MySQL.pm
0 → 100755
+
71
−
0
View file @
01f32cd6
#!/usr/bin/perl
use
strict
;
my
$do_zip
=
1
;
my
$do_bup
=
1
;
sub
new
{
my
$class
=
shift
;
my
$self
=
{};
bless
$self
,
$class
;
$self
->
set
(
@
_
);
$self
;
}
sub
set
{
my
$self
=
shift
;
my
%par
=
@_
;
foreach
my
$par
(
keys
%par
)
{
$self
->
{
$par
}
=
$par
{
$par
};
}
$self
;
}
sub
mk_mysql_dump
{
my
$self
=
shift
;
my
$fnm
=
shift
;
my
@rest
=
@_
;
my
(
$user
,
$pass
,
$db_name
)
=
map
{
$self
->
{
$_
}
or
die
}
qw(user pass db)
;
$fnm
=
sprintf
('
%s_%s.dump
',
$db_name
,
ts_ISO
())
unless
(
$fnm
);
print
"
saving to fnm=[
$fnm
]
\n
";
my
@cmd1
=
('
/usr/bin/mysqldump
',
'
-u
',
$user
);
push
(
@cmd1
,
"
--password=
$pass
");
# push (@cmd1, '-p', $pass); # does not work that way!
my
$idx_p
=
$#cmd1
;
push
(
@cmd1
,
@rest
);
push
(
@cmd1
,
'
-r
',
$fnm
,
$db_name
);
my
@cmd2
=
@cmd1
;
$cmd2
[
$idx_p
]
=
"
--password='xxxx'
";
# $cmd2[$idx_p]= 'xxxx';
print
"
cmd: [
",
join
('
',
@cmd2
),
"
]
\n
";
if
(
$do_bup
)
{
system
(
@cmd1
);
print
"
\n\n
";
system
('
gzip
',
'
-v
',
$fnm
)
if
(
$do_zip
);
}
}
sub
ts_ISO
{
my
$t
=
shift
||
time
();
my
@t
=
localtime
(
$t
);
sprintf
("
%4d-%02d-%02dT%02d%02d%02d
",
$t
[
5
]
+
1900
,
$t
[
4
]
+
1
,
$t
[
3
],
$t
[
2
],
$t
[
1
],
$t
[
0
]);
}
1
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment