Restart Apache in a version agnostic way











up vote
0
down vote

favorite












I use latest Ubuntu 18.04 LAMP but might as well use Debian LAMP or CentOS or something else common.



To restart Apache2 I do:



systemctl restart apache2


But say "tomorrow" this changes the apache2 changes to apache3 or apache-3 or just apache.



What will be the most correct way to prevent a fail in restart? I assume this shell-glob is good:



systemctl restart apache*


Will you use this way as well, or something else?










share|improve this question




























    up vote
    0
    down vote

    favorite












    I use latest Ubuntu 18.04 LAMP but might as well use Debian LAMP or CentOS or something else common.



    To restart Apache2 I do:



    systemctl restart apache2


    But say "tomorrow" this changes the apache2 changes to apache3 or apache-3 or just apache.



    What will be the most correct way to prevent a fail in restart? I assume this shell-glob is good:



    systemctl restart apache*


    Will you use this way as well, or something else?










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I use latest Ubuntu 18.04 LAMP but might as well use Debian LAMP or CentOS or something else common.



      To restart Apache2 I do:



      systemctl restart apache2


      But say "tomorrow" this changes the apache2 changes to apache3 or apache-3 or just apache.



      What will be the most correct way to prevent a fail in restart? I assume this shell-glob is good:



      systemctl restart apache*


      Will you use this way as well, or something else?










      share|improve this question















      I use latest Ubuntu 18.04 LAMP but might as well use Debian LAMP or CentOS or something else common.



      To restart Apache2 I do:



      systemctl restart apache2


      But say "tomorrow" this changes the apache2 changes to apache3 or apache-3 or just apache.



      What will be the most correct way to prevent a fail in restart? I assume this shell-glob is good:



      systemctl restart apache*


      Will you use this way as well, or something else?







      apache-httpd wildcards version stability






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 18 at 1:07

























      asked Nov 18 at 0:52









      JohnDoea

      561032




      561032






















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          It will not just magically change.



          When it comes to apache for Debian/Ubuntu/Mint or httpd for Fedora/RHEL/CentOS, updates keep the same name with only the version number changing so the service unit will be the same. If a new release comes out such as apache3, that will be a different package and you'll have to configure and set that one up if you want to run a web server with it. apache2 will stay the same. httpd and httpd24 for Fedora/RHEL/CentOS are different packages and installing the latter doesn't change anything with the former.



          In regards to some of your comments, apt-get upgrade will upgrade the package to its latest version. It will install new packages for dependencies if necessary but it won't remove or change existing packages.






          share|improve this answer























          • This sounds to me a bit disturbing, pushes me more away from vanilla-Bash and towards Ansible (or I'm wrong here as well?).
            – JohnDoea
            Nov 18 at 1:24












          • Wouldn't running upgrade lamp-server^ -y again when Apache-3 comes out transduce my Apache?
            – JohnDoea
            Nov 18 at 1:26










          • Crap, maybe I need a Vagrant-Ansible-Docker stack after all, or maybe becoming more flexible with vanilla-Bash, I'm not sure.
            – JohnDoea
            Nov 18 at 1:27










          • Nasir could I speak with you in person please, I feel a bit lost between the options, I'll gladly share with you my GitHub account and the four small scripts I wrote. Your advice could help me much...
            – JohnDoea
            Nov 18 at 1:28










          • @JohnDoea Join me in chat.
            – Nasir Riley
            Nov 18 at 1:35











          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: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          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%2f482440%2frestart-apache-in-a-version-agnostic-way%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote



          accepted










          It will not just magically change.



          When it comes to apache for Debian/Ubuntu/Mint or httpd for Fedora/RHEL/CentOS, updates keep the same name with only the version number changing so the service unit will be the same. If a new release comes out such as apache3, that will be a different package and you'll have to configure and set that one up if you want to run a web server with it. apache2 will stay the same. httpd and httpd24 for Fedora/RHEL/CentOS are different packages and installing the latter doesn't change anything with the former.



          In regards to some of your comments, apt-get upgrade will upgrade the package to its latest version. It will install new packages for dependencies if necessary but it won't remove or change existing packages.






          share|improve this answer























          • This sounds to me a bit disturbing, pushes me more away from vanilla-Bash and towards Ansible (or I'm wrong here as well?).
            – JohnDoea
            Nov 18 at 1:24












          • Wouldn't running upgrade lamp-server^ -y again when Apache-3 comes out transduce my Apache?
            – JohnDoea
            Nov 18 at 1:26










          • Crap, maybe I need a Vagrant-Ansible-Docker stack after all, or maybe becoming more flexible with vanilla-Bash, I'm not sure.
            – JohnDoea
            Nov 18 at 1:27










          • Nasir could I speak with you in person please, I feel a bit lost between the options, I'll gladly share with you my GitHub account and the four small scripts I wrote. Your advice could help me much...
            – JohnDoea
            Nov 18 at 1:28










          • @JohnDoea Join me in chat.
            – Nasir Riley
            Nov 18 at 1:35















          up vote
          1
          down vote



          accepted










          It will not just magically change.



          When it comes to apache for Debian/Ubuntu/Mint or httpd for Fedora/RHEL/CentOS, updates keep the same name with only the version number changing so the service unit will be the same. If a new release comes out such as apache3, that will be a different package and you'll have to configure and set that one up if you want to run a web server with it. apache2 will stay the same. httpd and httpd24 for Fedora/RHEL/CentOS are different packages and installing the latter doesn't change anything with the former.



          In regards to some of your comments, apt-get upgrade will upgrade the package to its latest version. It will install new packages for dependencies if necessary but it won't remove or change existing packages.






          share|improve this answer























          • This sounds to me a bit disturbing, pushes me more away from vanilla-Bash and towards Ansible (or I'm wrong here as well?).
            – JohnDoea
            Nov 18 at 1:24












          • Wouldn't running upgrade lamp-server^ -y again when Apache-3 comes out transduce my Apache?
            – JohnDoea
            Nov 18 at 1:26










          • Crap, maybe I need a Vagrant-Ansible-Docker stack after all, or maybe becoming more flexible with vanilla-Bash, I'm not sure.
            – JohnDoea
            Nov 18 at 1:27










          • Nasir could I speak with you in person please, I feel a bit lost between the options, I'll gladly share with you my GitHub account and the four small scripts I wrote. Your advice could help me much...
            – JohnDoea
            Nov 18 at 1:28










          • @JohnDoea Join me in chat.
            – Nasir Riley
            Nov 18 at 1:35













          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          It will not just magically change.



          When it comes to apache for Debian/Ubuntu/Mint or httpd for Fedora/RHEL/CentOS, updates keep the same name with only the version number changing so the service unit will be the same. If a new release comes out such as apache3, that will be a different package and you'll have to configure and set that one up if you want to run a web server with it. apache2 will stay the same. httpd and httpd24 for Fedora/RHEL/CentOS are different packages and installing the latter doesn't change anything with the former.



          In regards to some of your comments, apt-get upgrade will upgrade the package to its latest version. It will install new packages for dependencies if necessary but it won't remove or change existing packages.






          share|improve this answer














          It will not just magically change.



          When it comes to apache for Debian/Ubuntu/Mint or httpd for Fedora/RHEL/CentOS, updates keep the same name with only the version number changing so the service unit will be the same. If a new release comes out such as apache3, that will be a different package and you'll have to configure and set that one up if you want to run a web server with it. apache2 will stay the same. httpd and httpd24 for Fedora/RHEL/CentOS are different packages and installing the latter doesn't change anything with the former.



          In regards to some of your comments, apt-get upgrade will upgrade the package to its latest version. It will install new packages for dependencies if necessary but it won't remove or change existing packages.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 18 at 1:48

























          answered Nov 18 at 1:02









          Nasir Riley

          2,176239




          2,176239












          • This sounds to me a bit disturbing, pushes me more away from vanilla-Bash and towards Ansible (or I'm wrong here as well?).
            – JohnDoea
            Nov 18 at 1:24












          • Wouldn't running upgrade lamp-server^ -y again when Apache-3 comes out transduce my Apache?
            – JohnDoea
            Nov 18 at 1:26










          • Crap, maybe I need a Vagrant-Ansible-Docker stack after all, or maybe becoming more flexible with vanilla-Bash, I'm not sure.
            – JohnDoea
            Nov 18 at 1:27










          • Nasir could I speak with you in person please, I feel a bit lost between the options, I'll gladly share with you my GitHub account and the four small scripts I wrote. Your advice could help me much...
            – JohnDoea
            Nov 18 at 1:28










          • @JohnDoea Join me in chat.
            – Nasir Riley
            Nov 18 at 1:35


















          • This sounds to me a bit disturbing, pushes me more away from vanilla-Bash and towards Ansible (or I'm wrong here as well?).
            – JohnDoea
            Nov 18 at 1:24












          • Wouldn't running upgrade lamp-server^ -y again when Apache-3 comes out transduce my Apache?
            – JohnDoea
            Nov 18 at 1:26










          • Crap, maybe I need a Vagrant-Ansible-Docker stack after all, or maybe becoming more flexible with vanilla-Bash, I'm not sure.
            – JohnDoea
            Nov 18 at 1:27










          • Nasir could I speak with you in person please, I feel a bit lost between the options, I'll gladly share with you my GitHub account and the four small scripts I wrote. Your advice could help me much...
            – JohnDoea
            Nov 18 at 1:28










          • @JohnDoea Join me in chat.
            – Nasir Riley
            Nov 18 at 1:35
















          This sounds to me a bit disturbing, pushes me more away from vanilla-Bash and towards Ansible (or I'm wrong here as well?).
          – JohnDoea
          Nov 18 at 1:24






          This sounds to me a bit disturbing, pushes me more away from vanilla-Bash and towards Ansible (or I'm wrong here as well?).
          – JohnDoea
          Nov 18 at 1:24














          Wouldn't running upgrade lamp-server^ -y again when Apache-3 comes out transduce my Apache?
          – JohnDoea
          Nov 18 at 1:26




          Wouldn't running upgrade lamp-server^ -y again when Apache-3 comes out transduce my Apache?
          – JohnDoea
          Nov 18 at 1:26












          Crap, maybe I need a Vagrant-Ansible-Docker stack after all, or maybe becoming more flexible with vanilla-Bash, I'm not sure.
          – JohnDoea
          Nov 18 at 1:27




          Crap, maybe I need a Vagrant-Ansible-Docker stack after all, or maybe becoming more flexible with vanilla-Bash, I'm not sure.
          – JohnDoea
          Nov 18 at 1:27












          Nasir could I speak with you in person please, I feel a bit lost between the options, I'll gladly share with you my GitHub account and the four small scripts I wrote. Your advice could help me much...
          – JohnDoea
          Nov 18 at 1:28




          Nasir could I speak with you in person please, I feel a bit lost between the options, I'll gladly share with you my GitHub account and the four small scripts I wrote. Your advice could help me much...
          – JohnDoea
          Nov 18 at 1:28












          @JohnDoea Join me in chat.
          – Nasir Riley
          Nov 18 at 1:35




          @JohnDoea Join me in chat.
          – Nasir Riley
          Nov 18 at 1:35


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f482440%2frestart-apache-in-a-version-agnostic-way%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          List directoties down one level, excluding some named directories and files

          list processes belonging to a network namespace

          list systemd RuntimeDirectory mounts