How to use Upstart scripts on CentOS7?

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











up vote
2
down vote

favorite












I need to create a file /etc/init/start_swift.conf with following commands:



description "mount swift drives"
start on runlevel [234]
stop on runlevel [0156]
exec /opt/swift/bin/mount_devices


But the problem is that I even don't have the init directory. I have put start_swift.conf into /etc/init.d/ but it doesn't work.
How to create this type of upstart files in CentOS7?










share|improve this question



























    up vote
    2
    down vote

    favorite












    I need to create a file /etc/init/start_swift.conf with following commands:



    description "mount swift drives"
    start on runlevel [234]
    stop on runlevel [0156]
    exec /opt/swift/bin/mount_devices


    But the problem is that I even don't have the init directory. I have put start_swift.conf into /etc/init.d/ but it doesn't work.
    How to create this type of upstart files in CentOS7?










    share|improve this question

























      up vote
      2
      down vote

      favorite









      up vote
      2
      down vote

      favorite











      I need to create a file /etc/init/start_swift.conf with following commands:



      description "mount swift drives"
      start on runlevel [234]
      stop on runlevel [0156]
      exec /opt/swift/bin/mount_devices


      But the problem is that I even don't have the init directory. I have put start_swift.conf into /etc/init.d/ but it doesn't work.
      How to create this type of upstart files in CentOS7?










      share|improve this question















      I need to create a file /etc/init/start_swift.conf with following commands:



      description "mount swift drives"
      start on runlevel [234]
      stop on runlevel [0156]
      exec /opt/swift/bin/mount_devices


      But the problem is that I even don't have the init directory. I have put start_swift.conf into /etc/init.d/ but it doesn't work.
      How to create this type of upstart files in CentOS7?







      linux centos init upstart






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 20 at 22:36









      Rui F Ribeiro

      38.2k1475125




      38.2k1475125










      asked May 16 '16 at 8:53









      Alexandr

      3471515




      3471515




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          There are two answers for this question.



          On CentOS 7 systemd is how you can run a service or script on start
          You put a .service file under /etc/systemd/system, which can look like this:



          ; /etc/systemd/system/swift.service
          [Unit]
          Description=Swift

          [Service]
          Type=notify
          ExecStart=myscript

          [Install]
          ; Runlevel here:
          WantedBy=multi-user.target


          But actually systemd can be used for mounting devices directly, if this is the intention of your script.



          For a (non-rpm-packaged) service you would put the a ".mount" file under /etc/systemd/system, e.g. /etc/systemd/system/var-lib-docker.mount.
          You might also want look into auto-mount options of systemd, see references.



          In order to load the files, use systemd daemon-reload.



          ; /etc/systemd/system/var-lib-docker.mount
          [Unit]
          Description="Mount a volume"
          Before=network.service

          [Mount]
          What=/dev/sdb1
          Where=/var/lib/docker
          ;Options=


          There is a lot you can tune, please refer to:



          References
          - https://www.freedesktop.org/software/systemd/man/systemd.service.html
          - https://www.freedesktop.org/software/systemd/man/systemd.mount.html
          - https://www.freedesktop.org/software/systemd/man/systemd.automount.html






          share|improve this answer





























            up vote
            3
            down vote













            Centos uses systemd, not Upstart.
            Systemd is backward compatible with SysV init scripts. According to LSB 3.1, the init script must have informational Comment Conventions, defining when the script has to start/stop and what is required for the script to start/stop.
            I would recommend checking this guide and rewriting your upstart script to systemd unit.






            share|improve this answer






















            • Welcome to U&L, can you post revelent part of the link ?
              – Archemar
              May 16 '16 at 9:13










            • Relevant part? This is the official RedHat documentation on how to write systemd units.
              – Hristo Mohamed
              May 16 '16 at 9:50










            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%2f283391%2fhow-to-use-upstart-scripts-on-centos7%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            3
            down vote



            accepted










            There are two answers for this question.



            On CentOS 7 systemd is how you can run a service or script on start
            You put a .service file under /etc/systemd/system, which can look like this:



            ; /etc/systemd/system/swift.service
            [Unit]
            Description=Swift

            [Service]
            Type=notify
            ExecStart=myscript

            [Install]
            ; Runlevel here:
            WantedBy=multi-user.target


            But actually systemd can be used for mounting devices directly, if this is the intention of your script.



            For a (non-rpm-packaged) service you would put the a ".mount" file under /etc/systemd/system, e.g. /etc/systemd/system/var-lib-docker.mount.
            You might also want look into auto-mount options of systemd, see references.



            In order to load the files, use systemd daemon-reload.



            ; /etc/systemd/system/var-lib-docker.mount
            [Unit]
            Description="Mount a volume"
            Before=network.service

            [Mount]
            What=/dev/sdb1
            Where=/var/lib/docker
            ;Options=


            There is a lot you can tune, please refer to:



            References
            - https://www.freedesktop.org/software/systemd/man/systemd.service.html
            - https://www.freedesktop.org/software/systemd/man/systemd.mount.html
            - https://www.freedesktop.org/software/systemd/man/systemd.automount.html






            share|improve this answer


























              up vote
              3
              down vote



              accepted










              There are two answers for this question.



              On CentOS 7 systemd is how you can run a service or script on start
              You put a .service file under /etc/systemd/system, which can look like this:



              ; /etc/systemd/system/swift.service
              [Unit]
              Description=Swift

              [Service]
              Type=notify
              ExecStart=myscript

              [Install]
              ; Runlevel here:
              WantedBy=multi-user.target


              But actually systemd can be used for mounting devices directly, if this is the intention of your script.



              For a (non-rpm-packaged) service you would put the a ".mount" file under /etc/systemd/system, e.g. /etc/systemd/system/var-lib-docker.mount.
              You might also want look into auto-mount options of systemd, see references.



              In order to load the files, use systemd daemon-reload.



              ; /etc/systemd/system/var-lib-docker.mount
              [Unit]
              Description="Mount a volume"
              Before=network.service

              [Mount]
              What=/dev/sdb1
              Where=/var/lib/docker
              ;Options=


              There is a lot you can tune, please refer to:



              References
              - https://www.freedesktop.org/software/systemd/man/systemd.service.html
              - https://www.freedesktop.org/software/systemd/man/systemd.mount.html
              - https://www.freedesktop.org/software/systemd/man/systemd.automount.html






              share|improve this answer
























                up vote
                3
                down vote



                accepted







                up vote
                3
                down vote



                accepted






                There are two answers for this question.



                On CentOS 7 systemd is how you can run a service or script on start
                You put a .service file under /etc/systemd/system, which can look like this:



                ; /etc/systemd/system/swift.service
                [Unit]
                Description=Swift

                [Service]
                Type=notify
                ExecStart=myscript

                [Install]
                ; Runlevel here:
                WantedBy=multi-user.target


                But actually systemd can be used for mounting devices directly, if this is the intention of your script.



                For a (non-rpm-packaged) service you would put the a ".mount" file under /etc/systemd/system, e.g. /etc/systemd/system/var-lib-docker.mount.
                You might also want look into auto-mount options of systemd, see references.



                In order to load the files, use systemd daemon-reload.



                ; /etc/systemd/system/var-lib-docker.mount
                [Unit]
                Description="Mount a volume"
                Before=network.service

                [Mount]
                What=/dev/sdb1
                Where=/var/lib/docker
                ;Options=


                There is a lot you can tune, please refer to:



                References
                - https://www.freedesktop.org/software/systemd/man/systemd.service.html
                - https://www.freedesktop.org/software/systemd/man/systemd.mount.html
                - https://www.freedesktop.org/software/systemd/man/systemd.automount.html






                share|improve this answer














                There are two answers for this question.



                On CentOS 7 systemd is how you can run a service or script on start
                You put a .service file under /etc/systemd/system, which can look like this:



                ; /etc/systemd/system/swift.service
                [Unit]
                Description=Swift

                [Service]
                Type=notify
                ExecStart=myscript

                [Install]
                ; Runlevel here:
                WantedBy=multi-user.target


                But actually systemd can be used for mounting devices directly, if this is the intention of your script.



                For a (non-rpm-packaged) service you would put the a ".mount" file under /etc/systemd/system, e.g. /etc/systemd/system/var-lib-docker.mount.
                You might also want look into auto-mount options of systemd, see references.



                In order to load the files, use systemd daemon-reload.



                ; /etc/systemd/system/var-lib-docker.mount
                [Unit]
                Description="Mount a volume"
                Before=network.service

                [Mount]
                What=/dev/sdb1
                Where=/var/lib/docker
                ;Options=


                There is a lot you can tune, please refer to:



                References
                - https://www.freedesktop.org/software/systemd/man/systemd.service.html
                - https://www.freedesktop.org/software/systemd/man/systemd.mount.html
                - https://www.freedesktop.org/software/systemd/man/systemd.automount.html







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited May 16 '16 at 9:45

























                answered May 16 '16 at 9:21









                Mandragor

                417313




                417313






















                    up vote
                    3
                    down vote













                    Centos uses systemd, not Upstart.
                    Systemd is backward compatible with SysV init scripts. According to LSB 3.1, the init script must have informational Comment Conventions, defining when the script has to start/stop and what is required for the script to start/stop.
                    I would recommend checking this guide and rewriting your upstart script to systemd unit.






                    share|improve this answer






















                    • Welcome to U&L, can you post revelent part of the link ?
                      – Archemar
                      May 16 '16 at 9:13










                    • Relevant part? This is the official RedHat documentation on how to write systemd units.
                      – Hristo Mohamed
                      May 16 '16 at 9:50














                    up vote
                    3
                    down vote













                    Centos uses systemd, not Upstart.
                    Systemd is backward compatible with SysV init scripts. According to LSB 3.1, the init script must have informational Comment Conventions, defining when the script has to start/stop and what is required for the script to start/stop.
                    I would recommend checking this guide and rewriting your upstart script to systemd unit.






                    share|improve this answer






















                    • Welcome to U&L, can you post revelent part of the link ?
                      – Archemar
                      May 16 '16 at 9:13










                    • Relevant part? This is the official RedHat documentation on how to write systemd units.
                      – Hristo Mohamed
                      May 16 '16 at 9:50












                    up vote
                    3
                    down vote










                    up vote
                    3
                    down vote









                    Centos uses systemd, not Upstart.
                    Systemd is backward compatible with SysV init scripts. According to LSB 3.1, the init script must have informational Comment Conventions, defining when the script has to start/stop and what is required for the script to start/stop.
                    I would recommend checking this guide and rewriting your upstart script to systemd unit.






                    share|improve this answer














                    Centos uses systemd, not Upstart.
                    Systemd is backward compatible with SysV init scripts. According to LSB 3.1, the init script must have informational Comment Conventions, defining when the script has to start/stop and what is required for the script to start/stop.
                    I would recommend checking this guide and rewriting your upstart script to systemd unit.







                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited May 16 '16 at 9:12









                    Archemar

                    19.4k93468




                    19.4k93468










                    answered May 16 '16 at 9:02









                    Hristo Mohamed

                    787




                    787











                    • Welcome to U&L, can you post revelent part of the link ?
                      – Archemar
                      May 16 '16 at 9:13










                    • Relevant part? This is the official RedHat documentation on how to write systemd units.
                      – Hristo Mohamed
                      May 16 '16 at 9:50
















                    • Welcome to U&L, can you post revelent part of the link ?
                      – Archemar
                      May 16 '16 at 9:13










                    • Relevant part? This is the official RedHat documentation on how to write systemd units.
                      – Hristo Mohamed
                      May 16 '16 at 9:50















                    Welcome to U&L, can you post revelent part of the link ?
                    – Archemar
                    May 16 '16 at 9:13




                    Welcome to U&L, can you post revelent part of the link ?
                    – Archemar
                    May 16 '16 at 9:13












                    Relevant part? This is the official RedHat documentation on how to write systemd units.
                    – Hristo Mohamed
                    May 16 '16 at 9:50




                    Relevant part? This is the official RedHat documentation on how to write systemd units.
                    – Hristo Mohamed
                    May 16 '16 at 9:50

















                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f283391%2fhow-to-use-upstart-scripts-on-centos7%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

                    How to check contact read email or not when send email to Individual?

                    Bahrain

                    Postfix configuration issue with fips on centos 7; mailgun relay