Apache and systemd

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
5
down vote

favorite
2












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:




  1. apache2ctl restart or apache2ctl graceful


  2. systemctl restart apache2 and it seems systemctl restart apache2.service does 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.










share|improve this question



























    up vote
    5
    down vote

    favorite
    2












    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:




    1. apache2ctl restart or apache2ctl graceful


    2. systemctl restart apache2 and it seems systemctl restart apache2.service does 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.










    share|improve this question

























      up vote
      5
      down vote

      favorite
      2









      up vote
      5
      down vote

      favorite
      2






      2





      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:




      1. apache2ctl restart or apache2ctl graceful


      2. systemctl restart apache2 and it seems systemctl restart apache2.service does 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.










      share|improve this question















      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:




      1. apache2ctl restart or apache2ctl graceful


      2. systemctl restart apache2 and it seems systemctl restart apache2.service does 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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      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




















          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.






          share|improve this answer






















          • So systemctl status doesn't use apache2ctl?
            – artfulrobot
            Nov 4 '15 at 8:36






          • 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










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "106"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          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






























          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.






          share|improve this answer






















          • So systemctl status doesn't use apache2ctl?
            – artfulrobot
            Nov 4 '15 at 8:36






          • 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














          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.






          share|improve this answer






















          • So systemctl status doesn't use apache2ctl?
            – artfulrobot
            Nov 4 '15 at 8:36






          • 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












          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.






          share|improve this answer














          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.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          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 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
















          • So systemctl status doesn't use apache2ctl?
            – artfulrobot
            Nov 4 '15 at 8:36






          • 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















          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

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          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













































































          Popular posts from this blog

          Peggy Mitchell

          Palaiologos

          The Forum (Inglewood, California)