Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
lolo888
ISPConfig 3
Commits
6d6643de
Commit
6d6643de
authored
Sep 24, 2014
by
Till Brehm
Browse files
Fixed service restart problems on CentOS 7.
parent
9b021b2e
Changes
2
Hide whitespace changes
Inline
Side-by-side
server/lib/classes/system.inc.php
View file @
6d6643de
...
...
@@ -1722,7 +1722,7 @@ class system{
function
getinitcommand
(
$servicename
,
$action
,
$init_script_directory
=
''
){
global
$conf
;
// systemd
if
(
is_executable
(
'/bin/systemd'
)){
if
(
is_executable
(
'/bin/systemd'
)
||
is_executable
(
'/usr/bin/systemctl'
)
){
return
'systemctl '
.
$action
.
' '
.
$servicename
.
'.service'
;
}
// upstart
...
...
server/mods-available/web_module.inc.php
View file @
6d6643de
...
...
@@ -212,11 +212,12 @@ class web_module {
$retval
=
array
(
'output'
=>
''
,
'retval'
=>
0
);
if
(
$action
==
'restart'
)
{
exec
(
$app
->
system
->
getinitcommand
(
$daemon
,
'restart'
)
.
' 2>&1'
,
$retval
[
'output'
],
$retval
[
'retval'
]);
$cmd
=
$app
->
system
->
getinitcommand
(
$daemon
,
'restart'
);
}
else
{
exec
(
$app
->
system
->
getinitcommand
(
$daemon
,
'reload'
)
.
' 2>&1'
,
$retval
[
'output'
],
$retval
[
'retval'
])
;
$cmd
=
$app
->
system
->
getinitcommand
(
$daemon
,
'reload'
);
}
exec
(
$cmd
.
' 2>&1'
,
$retval
[
'output'
],
$retval
[
'retval'
]);
$app
->
log
(
"Restarting httpd:
$cmd
"
,
LOGLEVEL_DEBUG
);
// nginx: do a syntax check because on some distributions, the init script always returns 0 - even if the syntax is not ok (how stupid is that?)
if
(
$web_config
[
'server_type'
]
==
'nginx'
&&
$retval
[
'retval'
]
==
0
){
...
...
@@ -249,6 +250,22 @@ class web_module {
if
(
preg_match
(
'/^ID=ubuntu/m'
,
$tmp
)
&&
preg_match
(
'/^VERSION_ID="14\.04"/m'
,
$tmp
))
{
$initcommand
=
'/sbin/start-stop-daemon --stop --signal USR2 --quiet --pidfile /var/run/php5-fpm.pid --name php5-fpm'
;
}
// And the next workaround, php-fpm reloads in centos 7 downt work as well.
if
(
preg_match
(
'/^ID=centos/m'
,
$tmp
)
&&
preg_match
(
'/^VERSION_ID="7"/m'
,
$tmp
))
{
$initcommand
=
'systemctl restart php-fpm.service'
;
}
unset
(
$tmp
);
}
}
if
(
$action
==
'reload'
)
{
// And the next workaround, php-fpm reloads in centos 7 downt work as well.
if
(
file_exists
(
'/etc/os-release'
))
{
$tmp
=
file_get_contents
(
'/etc/os-release'
);
// And the next workaround, php-fpm reloads in centos 7 downt work as well.
if
(
preg_match
(
'/^ID="centos"/m'
,
$tmp
)
&&
preg_match
(
'/^VERSION_ID="7"/m'
,
$tmp
))
{
$initcommand
=
'systemctl restart php-fpm.service'
;
}
unset
(
$tmp
);
}
}
...
...
@@ -256,6 +273,7 @@ class web_module {
$retval
=
array
(
'output'
=>
''
,
'retval'
=>
0
);
exec
(
$initcommand
.
' 2>&1'
,
$retval
[
'output'
],
$retval
[
'retval'
]);
$app
->
log
(
"Restarting php-fpm:
$initcommand
"
,
LOGLEVEL_DEBUG
);
return
$retval
;
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment