Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
lolo888
ISPConfig 3
Commits
039b461d
Commit
039b461d
authored
Mar 29, 2011
by
vogelor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rescue-module: now rescue of mysql works fine, even if the admin wanted to NOT rescue mysql
parent
849624af
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
15 deletions
+51
-15
interface/web/admin/templates/server_config_rescue_edit.htm
interface/web/admin/templates/server_config_rescue_edit.htm
+3
-0
server/lib/classes/monitor_tools.inc.php
server/lib/classes/monitor_tools.inc.php
+1
-1
server/mods-available/rescue_core_module.inc.php
server/mods-available/rescue_core_module.inc.php
+4
-6
server/server.php
server/server.php
+43
-8
No files found.
interface/web/admin/templates/server_config_rescue_edit.htm
View file @
039b461d
...
@@ -30,6 +30,9 @@
...
@@ -30,6 +30,9 @@
</div>
</div>
</div>
</div>
</fieldset>
</fieldset>
Information: If you want to shut down mysql you have to disable "rescue mysql" and then wait 2-3 minutes.
<br>
if you do not wait 2-3 minutes, rescue will try to restart mysql!
<input
type=
"hidden"
name=
"id"
value=
"{tmpl_var name='id'}"
>
<input
type=
"hidden"
name=
"id"
value=
"{tmpl_var name='id'}"
>
...
...
server/lib/classes/monitor_tools.inc.php
View file @
039b461d
...
@@ -519,7 +519,7 @@ class monitor_tools {
...
@@ -519,7 +519,7 @@ class monitor_tools {
$server_id
=
intval
(
$conf
[
'server_id'
]);
$server_id
=
intval
(
$conf
[
'server_id'
]);
/** get the "active" Services of the server from the DB */
/** get the "active" Services of the server from the DB */
$services
=
$app
->
db
master
->
queryOneRecord
(
'SELECT * FROM server WHERE server_id = '
.
$server_id
);
$services
=
$app
->
db
->
queryOneRecord
(
'SELECT * FROM server WHERE server_id = '
.
$server_id
);
/*
/*
* If the DB is down, we have to set the db to "yes".
* If the DB is down, we have to set the db to "yes".
* If we don't do this, then the monitor will NOT monitor, that the db is down and so the
* If we don't do this, then the monitor will NOT monitor, that the db is down and so the
...
...
server/mods-available/rescue_core_module.inc.php
View file @
039b461d
...
@@ -89,14 +89,14 @@ class rescue_core_module {
...
@@ -89,14 +89,14 @@ class rescue_core_module {
$this
->
_rescueData
=
$this
->
_getRescueData
();
$this
->
_rescueData
=
$this
->
_getRescueData
();
/*
/*
* rescue
apache if needed
* rescue
mysql if needed (maybe apache depends on mysql, so try this first!)
*/
*/
$this
->
_rescue
Apache
();
$this
->
_rescue
MySql
();
/*
/*
* rescue
mysql
if needed
* rescue
apache
if needed
*/
*/
$this
->
_rescue
MySql
();
$this
->
_rescue
Apache
();
/*
/*
* The last step is to save the rescue-data
* The last step is to save the rescue-data
...
@@ -273,7 +273,6 @@ class rescue_core_module {
...
@@ -273,7 +273,6 @@ class rescue_core_module {
$app
->
log
(
'Apache is down! Try rescue apache (try:'
.
$tryCount
.
')...'
,
LOGLEVEL_WARN
);
$app
->
log
(
'Apache is down! Try rescue apache (try:'
.
$tryCount
.
')...'
,
LOGLEVEL_WARN
);
// echo 'Apache is down! Try rescue apache (try:' . $tryCount . ')...';
if
(
is_file
(
$conf
[
'init_scripts'
]
.
'/'
.
'httpd'
))
{
if
(
is_file
(
$conf
[
'init_scripts'
]
.
'/'
.
'httpd'
))
{
$daemon
=
'httpd'
;
$daemon
=
'httpd'
;
...
@@ -340,7 +339,6 @@ class rescue_core_module {
...
@@ -340,7 +339,6 @@ class rescue_core_module {
$app
->
log
(
'MySQL is down! Try rescue mysql (try:'
.
$tryCount
.
')...'
,
LOGLEVEL_WARN
);
$app
->
log
(
'MySQL is down! Try rescue mysql (try:'
.
$tryCount
.
')...'
,
LOGLEVEL_WARN
);
// echo 'MySQL is down! Try rescue mysql (try:' . $tryCount . ')...';
if
(
is_file
(
$conf
[
'init_scripts'
]
.
'/'
.
'mysqld'
))
{
if
(
is_file
(
$conf
[
'init_scripts'
]
.
'/'
.
'mysqld'
))
{
$daemon
=
'mysqld'
;
$daemon
=
'mysqld'
;
...
...
server/server.php
View file @
039b461d
<?php
<?php
/*
/*
Copyright (c) 2007, Till Brehm, projektfarm Gmbh
Copyright (c) 2007
-2011
, Till Brehm, projektfarm Gmbh
All rights reserved.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
Redistribution and use in source and binary forms, with or without modification,
...
@@ -54,33 +54,68 @@ $conf['server_id'] = intval($conf['server_id']);
...
@@ -54,33 +54,68 @@ $conf['server_id'] = intval($conf['server_id']);
* Try to Load the server configuration from the master-db
* Try to Load the server configuration from the master-db
*/
*/
if
(
$app
->
dbmaster
->
connect
())
{
if
(
$app
->
dbmaster
->
connect
())
{
// get the dalaog_id of the last performed record
$server_db_record
=
$app
->
dbmaster
->
queryOneRecord
(
"SELECT * FROM server WHERE server_id = "
.
$conf
[
'server_id'
]);
$server_db_record
=
$app
->
dbmaster
->
queryOneRecord
(
"SELECT * FROM server WHERE server_id = "
.
$conf
[
'server_id'
]);
$conf
[
'last_datalog_id'
]
=
(
int
)
$server_db_record
[
'updated'
];
$conf
[
'last_datalog_id'
]
=
(
int
)
$server_db_record
[
'updated'
];
$conf
[
'mirror_server_id'
]
=
(
int
)
$server_db_record
[
'mirror_server_id'
];
$conf
[
'mirror_server_id'
]
=
(
int
)
$server_db_record
[
'mirror_server_id'
];
// Load the ini_parser
// Load the ini_parser
$app
->
uses
(
'ini_parser'
);
$app
->
uses
(
'ini_parser'
);
// Get server configuration
// Get server configuration
$conf
[
'serverconfig'
]
=
$app
->
ini_parser
->
parse_ini_string
(
stripslashes
(
$server_db_record
[
'config'
]));
$conf
[
'serverconfig'
]
=
$app
->
ini_parser
->
parse_ini_string
(
stripslashes
(
$server_db_record
[
'config'
]));
// Set the loglevel
// Set the loglevel
$conf
[
'log_priority'
]
=
intval
(
$conf
[
'serverconfig'
][
'server'
][
'loglevel'
]);
$conf
[
'log_priority'
]
=
intval
(
$conf
[
'serverconfig'
][
'server'
][
'loglevel'
]);
// we do not need this variable anymore
unset
(
$server_db_record
);
unset
(
$server_db_record
);
/*
* Save the rescue-config, maybe we need it (because the database is down)
*/
$tmp
[
'serverconfig'
][
'server'
][
'loglevel'
]
=
$conf
[
'log_priority'
];
$tmp
[
'serverconfig'
][
'rescue'
]
=
$conf
[
'serverconfig'
][
'rescue'
];
file_put_contents
(
dirname
(
__FILE__
)
.
"/temp/rescue_module_serverconfig.ser.txt"
,
serialize
(
$tmp
));
unset
(
$tmp
);
// protect the file
chmod
(
dirname
(
__FILE__
)
.
"/temp/rescue_module_serverconfig.ser.txt"
,
0600
);
}
else
{
}
else
{
/*
/*
* The master-db is not available.
* The master-db is not available.
* Problem: because we need to start the rescue-module (to rescue the DB if this IS the
* Problem: because we need to start the rescue-module (to rescue the DB if this IS the
* server, the master-db is running at) we have to initialize some config...
* server, the master-db is running at) we have to initialize some config...
*/
*/
$conf
[
'last_datalog_id'
]
=
intval
(
'9223372036854775807'
);
// maxint at 32 and 64 bit systems
$conf
[
'mirror_server_id'
]
=
0
;
// no mirror
/*
// Set the loglevel to warning
* If there is a temp-file with the data we could get from the database, then we use it
$conf
[
'log_priority'
]
=
LOGLEVEL_WARN
;
*/
$tmp
=
array
();
if
(
file_exists
(
dirname
(
__FILE__
)
.
"/temp/rescue_module_serverconfig.ser.txt"
)){
$tmp
=
unserialize
(
file_get_contents
(
dirname
(
__FILE__
)
.
"/temp/rescue_module_serverconfig.ser.txt"
));
}
// maxint at 32 and 64 bit systems
$conf
[
'last_datalog_id'
]
=
intval
(
'9223372036854775807'
);
// no mirror
$conf
[
'mirror_server_id'
]
=
0
;
// Set the loglevel
$conf
[
'log_priority'
]
=
(
isset
(
$tmp
[
'serverconfig'
][
'server'
][
'loglevel'
]))
?
$tmp
[
'serverconfig'
][
'server'
][
'loglevel'
]
:
LOGLEVEL_ERROR
;
/*
/*
* Set the configuration to rescue the database
* Set the configuration to rescue the database
*/
*/
$conf
[
'serverconfig'
][
'rescue'
][
'try_rescue'
]
=
'y'
;
if
(
isset
(
$tmp
[
'serverconfig'
][
'rescue'
])){
$conf
[
'serverconfig'
][
'rescue'
][
'do_not_try_rescue_mysql'
]
=
'n'
;
$conf
[
'serverconfig'
][
'rescue'
]
=
$tmp
[
'serverconfig'
][
'rescue'
];
}
else
{
$conf
[
'serverconfig'
][
'rescue'
][
'try_rescue'
]
=
'n'
;
}
// we do not need this variable anymore
unset
(
$tmp
);
}
}
...
...
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