Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
backupninja
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Liberate
backupninja
Commits
64edfccf
Commit
64edfccf
authored
16 years ago
by
rhatto
Committed by
micah
16 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fixes for mysql handler for mysqld inside a vserver
parent
668f8ddf
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
handlers/mysql.in
+31
-24
31 additions, 24 deletions
handlers/mysql.in
with
31 additions
and
24 deletions
handlers/mysql.in
+
31
−
24
View file @
64edfccf
...
...
@@ -88,8 +88,7 @@ if [ "$dbusername" != "" -a "$dbpassword" != "" ]
then
if
[
$usevserver
=
yes
]
then
vhome
=
`
$VSERVER
$vsname
exec
getent passwd
"root"
| @AWK@
-F
:
'{print $6}'
`
home
=
"
$vroot$vhome
"
home
=
`
$VSERVER
$vsname
exec
getent passwd
"root"
| @AWK@
-F
:
'{print $6}'
`
else
home
=
`
getent passwd
"root"
| @AWK@
-F
:
'{print $6}'
`
fi
...
...
@@ -97,18 +96,25 @@ then
[
-d
$home
]
||
fatal
"Can't find root's home directory (
$home
)."
mycnf
=
"
$home
/.my.cnf"
if
[
-f
$mycnf
]
if
[
$usevserver
=
yes
]
then
workcnf
=
"
$vroot$mycnf
"
else
workcnf
=
"
$mycnf
"
fi
if
[
-f
$workcnf
]
then
# rename temporarily
tmpcnf
=
"
$
home
/my.
cnf.disable"
debug
"mv
$
my
cnf
$tmpcnf
"
mv
$my
cnf
$tmpcnf
# rename temporarily
tmpcnf
=
"
$
work
cnf
.disable"
debug
"mv
$
work
cnf
$tmpcnf
"
mv
$work
cnf
$tmpcnf
fi
oldmask
=
`
umask
`
umask
077
cat
>
$
my
cnf
<<
EOF
cat
>
$
work
cnf
<<
EOF
# auto generated backupninja mysql conf
[mysql]
host=
$dbhost
...
...
@@ -124,14 +130,14 @@ password="$dbpassword"
host=
$dbhost
user=
$dbusername
password="
$dbpassword
"
[mysqladmin]
host=
$dbhost
user=
$dbusername
password="
$dbpassword
"
EOF
umask
$oldmask
if
[
$usevserver
=
yes
]
then
defaultsfile
=
"--defaults-extra-file=
$vhome
/.my.cnf"
else
defaultsfile
=
"--defaults-extra-file=
$mycnf
"
fi
defaultsfile
=
"--defaults-extra-file=
$mycnf
"
fi
# if a user is not set, use $configfile, otherwise use $mycnf
...
...
@@ -142,22 +148,23 @@ else
userset
=
true
;
if
[
$usevserver
=
yes
]
then
v
userhome
=
`
$VSERVER
$vsname
exec
getent passwd
"
$user
"
| @AWK@
-F
:
'{print $6}'
`
userhome
=
`
$VSERVER
$vsname
exec
getent passwd
"
$user
"
| @AWK@
-F
:
'{print $6}'
`
if
[
$?
-eq
2
]
then
fatal
"User
$user
not found in /etc/passwd"
fi
userhome
=
"
$vroot$vuserhome
"
debug
"User home set to:
$vroot$userhome
"
[
-f
$vroot$userhome
/.my.cnf
]
||
fatal
"Can't find config file in
$userhome
/.my.cnf"
else
userhome
=
`
getent passwd
"
$user
"
| @AWK@
-F
:
'{print $6}'
`
if
[
$?
-eq
2
]
then
fatal
"User
$user
not found in /etc/passwd"
fi
fi
debug
"User home set to:
$userhome
"
[
-f
$userhome
/.my.cnf
]
||
fatal
"Can't find config file in
$userhome
/.my.cnf"
fi
debug
"User home set to:
$userhome
"
[
-f
$userhome
/.my.cnf
]
||
fatal
"Can't find config file in
$userhome
/.my.cnf"
defaultsfile
=
"--defaults-extra-file=
$userhome
/.my.cnf"
debug
"using
$defaultsfile
"
fi
...
...
@@ -307,12 +314,12 @@ fi
if
[
"
$dbusername
"
!=
""
-a
"
$dbpassword
"
!=
""
]
then
## clean up tmp config file
debug
"rm
$
my
cnf
"
rm
$
my
cnf
debug
"rm
$
work
cnf
"
rm
$
work
cnf
if
[
-f
"
$tmpcnf
"
]
then
debug
"mv
$tmpcnf
$
my
cnf
"
mv
$tmpcnf
$
my
cnf
debug
"mv
$tmpcnf
$
work
cnf
"
mv
$tmpcnf
$
work
cnf
fi
fi
...
...
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