Apache and systemd

Clash Royale CLAN TAG#URR8PPP
up vote
5
down vote
favorite
I've just started using Debian 8 which has introduced systemd. I'm not interested in the politics around SysV vs systemd, but I am confused, especially around Apache (2.4).
There are now two ways to restart apache:
apache2ctl restartorapache2ctl gracefulsystemctl restart apache2and it seemssystemctl restart apache2.servicedoes the same thing.
And they appear to do different things(!). I don't understand the difference.
I seem to need to do both to get a proper full restart working. e.g. after changing a config file for the php module it only noted the change after both.
Another time when apache2ctl configtest was failing and the failure was reported in systemctl status apache2 I fixed the config so that the first of these commands was happy, restarted with apache2ctl restart but the systemd status command still listed it as not running and with the old config problem.
I promise to spend ages reading about systemd (RTFM) in depth at some point, but meanwhile on a practical level relating to apache, I'd appreciate advice.
debian systemd apache-httpd
add a comment |Â
up vote
5
down vote
favorite
I've just started using Debian 8 which has introduced systemd. I'm not interested in the politics around SysV vs systemd, but I am confused, especially around Apache (2.4).
There are now two ways to restart apache:
apache2ctl restartorapache2ctl gracefulsystemctl restart apache2and it seemssystemctl restart apache2.servicedoes the same thing.
And they appear to do different things(!). I don't understand the difference.
I seem to need to do both to get a proper full restart working. e.g. after changing a config file for the php module it only noted the change after both.
Another time when apache2ctl configtest was failing and the failure was reported in systemctl status apache2 I fixed the config so that the first of these commands was happy, restarted with apache2ctl restart but the systemd status command still listed it as not running and with the old config problem.
I promise to spend ages reading about systemd (RTFM) in depth at some point, but meanwhile on a practical level relating to apache, I'd appreciate advice.
debian systemd apache-httpd
add a comment |Â
up vote
5
down vote
favorite
up vote
5
down vote
favorite
I've just started using Debian 8 which has introduced systemd. I'm not interested in the politics around SysV vs systemd, but I am confused, especially around Apache (2.4).
There are now two ways to restart apache:
apache2ctl restartorapache2ctl gracefulsystemctl restart apache2and it seemssystemctl restart apache2.servicedoes the same thing.
And they appear to do different things(!). I don't understand the difference.
I seem to need to do both to get a proper full restart working. e.g. after changing a config file for the php module it only noted the change after both.
Another time when apache2ctl configtest was failing and the failure was reported in systemctl status apache2 I fixed the config so that the first of these commands was happy, restarted with apache2ctl restart but the systemd status command still listed it as not running and with the old config problem.
I promise to spend ages reading about systemd (RTFM) in depth at some point, but meanwhile on a practical level relating to apache, I'd appreciate advice.
debian systemd apache-httpd
I've just started using Debian 8 which has introduced systemd. I'm not interested in the politics around SysV vs systemd, but I am confused, especially around Apache (2.4).
There are now two ways to restart apache:
apache2ctl restartorapache2ctl gracefulsystemctl restart apache2and it seemssystemctl restart apache2.servicedoes the same thing.
And they appear to do different things(!). I don't understand the difference.
I seem to need to do both to get a proper full restart working. e.g. after changing a config file for the php module it only noted the change after both.
Another time when apache2ctl configtest was failing and the failure was reported in systemctl status apache2 I fixed the config so that the first of these commands was happy, restarted with apache2ctl restart but the systemd status command still listed it as not running and with the old config problem.
I promise to spend ages reading about systemd (RTFM) in depth at some point, but meanwhile on a practical level relating to apache, I'd appreciate advice.
debian systemd apache-httpd
debian systemd apache-httpd
edited Jul 19 '16 at 1:04
Jeff Schaller
32.3k849110
32.3k849110
asked Nov 3 '15 at 16:39
artfulrobot
1,14921424
1,14921424
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
5
down vote
accepted
If you want consistency, always use systemctl for stop, start, and restart. That ends up using the apache2ctl program - for now via the /etc/init.d/apache2 script but probably from a native systemd unit file in the future.
systemd won't know when you've used apache2ctl directly, possibly resulting (as you've discovered) in a situation where systemd thinks apache2 is still in a faulty state when it's actually running fine.
For configtest and status, use apache2ctl. They just query apache without changing its state.
So systemctl status doesn't use apache2ctl?
â artfulrobot
Nov 4 '15 at 8:36
3
systemctl status apache2tells you if the service is running.apache2ctl statusgives you the output frommod_statusif it is enabled and configured.
â cas
Nov 4 '15 at 9:20
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
5
down vote
accepted
If you want consistency, always use systemctl for stop, start, and restart. That ends up using the apache2ctl program - for now via the /etc/init.d/apache2 script but probably from a native systemd unit file in the future.
systemd won't know when you've used apache2ctl directly, possibly resulting (as you've discovered) in a situation where systemd thinks apache2 is still in a faulty state when it's actually running fine.
For configtest and status, use apache2ctl. They just query apache without changing its state.
So systemctl status doesn't use apache2ctl?
â artfulrobot
Nov 4 '15 at 8:36
3
systemctl status apache2tells you if the service is running.apache2ctl statusgives you the output frommod_statusif it is enabled and configured.
â cas
Nov 4 '15 at 9:20
add a comment |Â
up vote
5
down vote
accepted
If you want consistency, always use systemctl for stop, start, and restart. That ends up using the apache2ctl program - for now via the /etc/init.d/apache2 script but probably from a native systemd unit file in the future.
systemd won't know when you've used apache2ctl directly, possibly resulting (as you've discovered) in a situation where systemd thinks apache2 is still in a faulty state when it's actually running fine.
For configtest and status, use apache2ctl. They just query apache without changing its state.
So systemctl status doesn't use apache2ctl?
â artfulrobot
Nov 4 '15 at 8:36
3
systemctl status apache2tells you if the service is running.apache2ctl statusgives you the output frommod_statusif it is enabled and configured.
â cas
Nov 4 '15 at 9:20
add a comment |Â
up vote
5
down vote
accepted
up vote
5
down vote
accepted
If you want consistency, always use systemctl for stop, start, and restart. That ends up using the apache2ctl program - for now via the /etc/init.d/apache2 script but probably from a native systemd unit file in the future.
systemd won't know when you've used apache2ctl directly, possibly resulting (as you've discovered) in a situation where systemd thinks apache2 is still in a faulty state when it's actually running fine.
For configtest and status, use apache2ctl. They just query apache without changing its state.
If you want consistency, always use systemctl for stop, start, and restart. That ends up using the apache2ctl program - for now via the /etc/init.d/apache2 script but probably from a native systemd unit file in the future.
systemd won't know when you've used apache2ctl directly, possibly resulting (as you've discovered) in a situation where systemd thinks apache2 is still in a faulty state when it's actually running fine.
For configtest and status, use apache2ctl. They just query apache without changing its state.
edited Mar 14 at 11:05
Jeff Schaller
32.3k849110
32.3k849110
answered Nov 3 '15 at 23:54
cas
37.8k44394
37.8k44394
So systemctl status doesn't use apache2ctl?
â artfulrobot
Nov 4 '15 at 8:36
3
systemctl status apache2tells you if the service is running.apache2ctl statusgives you the output frommod_statusif it is enabled and configured.
â cas
Nov 4 '15 at 9:20
add a comment |Â
So systemctl status doesn't use apache2ctl?
â artfulrobot
Nov 4 '15 at 8:36
3
systemctl status apache2tells you if the service is running.apache2ctl statusgives you the output frommod_statusif it is enabled and configured.
â cas
Nov 4 '15 at 9:20
So systemctl status doesn't use apache2ctl?
â artfulrobot
Nov 4 '15 at 8:36
So systemctl status doesn't use apache2ctl?
â artfulrobot
Nov 4 '15 at 8:36
3
3
systemctl status apache2 tells you if the service is running. apache2ctl status gives you the output from mod_status if it is enabled and configured.â cas
Nov 4 '15 at 9:20
systemctl status apache2 tells you if the service is running. apache2ctl status gives you the output from mod_status if it is enabled and configured.â cas
Nov 4 '15 at 9:20
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f240528%2fapache-and-systemd%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password