Where to put daemon files?












0














I wrote a couple daemons communicating over Unix domain sockets (raw sockets) and now I want to find the most suitable location for them on the production server. Where to put which files?



Here's what I got so far (feel free to suggest better locations):





  • Daemon binaries/executables: no clue... /usr/sbin/<subdir>/? /usr/bin/<subdir>/? Somewhere else?


  • Sockets: /var/run/<subdir>/ (no idea why but I wouldn't feel comfortable with /tmp/)


  • Log files: /var/log/<subdir>/


  • Configuration files: /etc/<subdir>/


The target OS is Ubuntu server 16.04+.










share|improve this question







New contributor




Sceptical Jule is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    0














    I wrote a couple daemons communicating over Unix domain sockets (raw sockets) and now I want to find the most suitable location for them on the production server. Where to put which files?



    Here's what I got so far (feel free to suggest better locations):





    • Daemon binaries/executables: no clue... /usr/sbin/<subdir>/? /usr/bin/<subdir>/? Somewhere else?


    • Sockets: /var/run/<subdir>/ (no idea why but I wouldn't feel comfortable with /tmp/)


    • Log files: /var/log/<subdir>/


    • Configuration files: /etc/<subdir>/


    The target OS is Ubuntu server 16.04+.










    share|improve this question







    New contributor




    Sceptical Jule is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      0












      0








      0







      I wrote a couple daemons communicating over Unix domain sockets (raw sockets) and now I want to find the most suitable location for them on the production server. Where to put which files?



      Here's what I got so far (feel free to suggest better locations):





      • Daemon binaries/executables: no clue... /usr/sbin/<subdir>/? /usr/bin/<subdir>/? Somewhere else?


      • Sockets: /var/run/<subdir>/ (no idea why but I wouldn't feel comfortable with /tmp/)


      • Log files: /var/log/<subdir>/


      • Configuration files: /etc/<subdir>/


      The target OS is Ubuntu server 16.04+.










      share|improve this question







      New contributor




      Sceptical Jule is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I wrote a couple daemons communicating over Unix domain sockets (raw sockets) and now I want to find the most suitable location for them on the production server. Where to put which files?



      Here's what I got so far (feel free to suggest better locations):





      • Daemon binaries/executables: no clue... /usr/sbin/<subdir>/? /usr/bin/<subdir>/? Somewhere else?


      • Sockets: /var/run/<subdir>/ (no idea why but I wouldn't feel comfortable with /tmp/)


      • Log files: /var/log/<subdir>/


      • Configuration files: /etc/<subdir>/


      The target OS is Ubuntu server 16.04+.







      filesystems daemon






      share|improve this question







      New contributor




      Sceptical Jule is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      Sceptical Jule is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      Sceptical Jule is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 3 hours ago









      Sceptical JuleSceptical Jule

      101




      101




      New contributor




      Sceptical Jule is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Sceptical Jule is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Sceptical Jule is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          2 Answers
          2






          active

          oldest

          votes


















          0














          When in doubt about Linux File System usage, consult the Filesystem Hierarchy Standard.




          • If the daemons are local to your server only: /usr/local/bin/

          • Sockets: Correct

          • log files: Correct

          • Config files: Correct






          share|improve this answer























          • This is a developer writing custom software. Edited for clarity. @couling
            – Fabby
            2 hours ago












          • The more I read this the more this answer is feels broken.
            – couling
            1 hour ago










          • Please post your own answer then and I'l delete mine if it's better. @couling Revision rolled back to original.
            – Fabby
            1 hour ago



















          0














          There are many fine resources on the standards, including https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.pdf



          I would suggest:





          • Sockets: /run/<subdir>/. That's because /var/run is just a sym-link to /run these days on Ubuntu. /run is the newer standard place for such things.


          • Log files: /var/log/<subdir>/ Correct. Although a single log doesn't actually need a directory. Don't forget to add an /etc/logrotate.d entry as well


          • Configuration files: /etc/<subdir>/ Correct. Again a single config file doesn't need a directory but it doesn't hurt.


          The binaries:



          These are tricky there's a whole bunch of places they can exist. Generally bin is for user commands, sbin is for server daemons. Some people say sbin is for binaries executed only by root. See here: https://askubuntu.com/questions/308045/differences-between-bin-sbin-usr-bin-usr-sbin-usr-local-bin-usr-local




          • Do NOT use /bin or /sbin. Reserve these for binaries required to boot your system.

          • Do use /usr/bin and /usr/sbin. Most things on unbuntu live here although there are exceptions. If you are properly packaging your software (into a .dpkg or similar) then definitely use /usr/bin and /usr/sbin.

          • If you don't intend to package it properly and just want to manually copy it as a sys admin then /usr/local/bin and /usr/local/sbin are more appropriate. But this generally shouldn't be used if you are going to distribute your code to other people.

          • If some of your binaries are only ever used by your other binaries, consider putting them under /usr/lib or /usr/local/lib. It's not uncommon for binaries to be thought of as libraries


          In short, /usr/sbin and /usr/bin` were most likely correct.






          share|improve this answer





















            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',
            autoActivateHeartbeat: false,
            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
            });


            }
            });






            Sceptical Jule is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f493342%2fwhere-to-put-daemon-files%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









            0














            When in doubt about Linux File System usage, consult the Filesystem Hierarchy Standard.




            • If the daemons are local to your server only: /usr/local/bin/

            • Sockets: Correct

            • log files: Correct

            • Config files: Correct






            share|improve this answer























            • This is a developer writing custom software. Edited for clarity. @couling
              – Fabby
              2 hours ago












            • The more I read this the more this answer is feels broken.
              – couling
              1 hour ago










            • Please post your own answer then and I'l delete mine if it's better. @couling Revision rolled back to original.
              – Fabby
              1 hour ago
















            0














            When in doubt about Linux File System usage, consult the Filesystem Hierarchy Standard.




            • If the daemons are local to your server only: /usr/local/bin/

            • Sockets: Correct

            • log files: Correct

            • Config files: Correct






            share|improve this answer























            • This is a developer writing custom software. Edited for clarity. @couling
              – Fabby
              2 hours ago












            • The more I read this the more this answer is feels broken.
              – couling
              1 hour ago










            • Please post your own answer then and I'l delete mine if it's better. @couling Revision rolled back to original.
              – Fabby
              1 hour ago














            0












            0








            0






            When in doubt about Linux File System usage, consult the Filesystem Hierarchy Standard.




            • If the daemons are local to your server only: /usr/local/bin/

            • Sockets: Correct

            • log files: Correct

            • Config files: Correct






            share|improve this answer














            When in doubt about Linux File System usage, consult the Filesystem Hierarchy Standard.




            • If the daemons are local to your server only: /usr/local/bin/

            • Sockets: Correct

            • log files: Correct

            • Config files: Correct







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited 1 hour ago

























            answered 3 hours ago









            FabbyFabby

            3,76611228




            3,76611228












            • This is a developer writing custom software. Edited for clarity. @couling
              – Fabby
              2 hours ago












            • The more I read this the more this answer is feels broken.
              – couling
              1 hour ago










            • Please post your own answer then and I'l delete mine if it's better. @couling Revision rolled back to original.
              – Fabby
              1 hour ago


















            • This is a developer writing custom software. Edited for clarity. @couling
              – Fabby
              2 hours ago












            • The more I read this the more this answer is feels broken.
              – couling
              1 hour ago










            • Please post your own answer then and I'l delete mine if it's better. @couling Revision rolled back to original.
              – Fabby
              1 hour ago
















            This is a developer writing custom software. Edited for clarity. @couling
            – Fabby
            2 hours ago






            This is a developer writing custom software. Edited for clarity. @couling
            – Fabby
            2 hours ago














            The more I read this the more this answer is feels broken.
            – couling
            1 hour ago




            The more I read this the more this answer is feels broken.
            – couling
            1 hour ago












            Please post your own answer then and I'l delete mine if it's better. @couling Revision rolled back to original.
            – Fabby
            1 hour ago




            Please post your own answer then and I'l delete mine if it's better. @couling Revision rolled back to original.
            – Fabby
            1 hour ago













            0














            There are many fine resources on the standards, including https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.pdf



            I would suggest:





            • Sockets: /run/<subdir>/. That's because /var/run is just a sym-link to /run these days on Ubuntu. /run is the newer standard place for such things.


            • Log files: /var/log/<subdir>/ Correct. Although a single log doesn't actually need a directory. Don't forget to add an /etc/logrotate.d entry as well


            • Configuration files: /etc/<subdir>/ Correct. Again a single config file doesn't need a directory but it doesn't hurt.


            The binaries:



            These are tricky there's a whole bunch of places they can exist. Generally bin is for user commands, sbin is for server daemons. Some people say sbin is for binaries executed only by root. See here: https://askubuntu.com/questions/308045/differences-between-bin-sbin-usr-bin-usr-sbin-usr-local-bin-usr-local




            • Do NOT use /bin or /sbin. Reserve these for binaries required to boot your system.

            • Do use /usr/bin and /usr/sbin. Most things on unbuntu live here although there are exceptions. If you are properly packaging your software (into a .dpkg or similar) then definitely use /usr/bin and /usr/sbin.

            • If you don't intend to package it properly and just want to manually copy it as a sys admin then /usr/local/bin and /usr/local/sbin are more appropriate. But this generally shouldn't be used if you are going to distribute your code to other people.

            • If some of your binaries are only ever used by your other binaries, consider putting them under /usr/lib or /usr/local/lib. It's not uncommon for binaries to be thought of as libraries


            In short, /usr/sbin and /usr/bin` were most likely correct.






            share|improve this answer


























              0














              There are many fine resources on the standards, including https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.pdf



              I would suggest:





              • Sockets: /run/<subdir>/. That's because /var/run is just a sym-link to /run these days on Ubuntu. /run is the newer standard place for such things.


              • Log files: /var/log/<subdir>/ Correct. Although a single log doesn't actually need a directory. Don't forget to add an /etc/logrotate.d entry as well


              • Configuration files: /etc/<subdir>/ Correct. Again a single config file doesn't need a directory but it doesn't hurt.


              The binaries:



              These are tricky there's a whole bunch of places they can exist. Generally bin is for user commands, sbin is for server daemons. Some people say sbin is for binaries executed only by root. See here: https://askubuntu.com/questions/308045/differences-between-bin-sbin-usr-bin-usr-sbin-usr-local-bin-usr-local




              • Do NOT use /bin or /sbin. Reserve these for binaries required to boot your system.

              • Do use /usr/bin and /usr/sbin. Most things on unbuntu live here although there are exceptions. If you are properly packaging your software (into a .dpkg or similar) then definitely use /usr/bin and /usr/sbin.

              • If you don't intend to package it properly and just want to manually copy it as a sys admin then /usr/local/bin and /usr/local/sbin are more appropriate. But this generally shouldn't be used if you are going to distribute your code to other people.

              • If some of your binaries are only ever used by your other binaries, consider putting them under /usr/lib or /usr/local/lib. It's not uncommon for binaries to be thought of as libraries


              In short, /usr/sbin and /usr/bin` were most likely correct.






              share|improve this answer
























                0












                0








                0






                There are many fine resources on the standards, including https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.pdf



                I would suggest:





                • Sockets: /run/<subdir>/. That's because /var/run is just a sym-link to /run these days on Ubuntu. /run is the newer standard place for such things.


                • Log files: /var/log/<subdir>/ Correct. Although a single log doesn't actually need a directory. Don't forget to add an /etc/logrotate.d entry as well


                • Configuration files: /etc/<subdir>/ Correct. Again a single config file doesn't need a directory but it doesn't hurt.


                The binaries:



                These are tricky there's a whole bunch of places they can exist. Generally bin is for user commands, sbin is for server daemons. Some people say sbin is for binaries executed only by root. See here: https://askubuntu.com/questions/308045/differences-between-bin-sbin-usr-bin-usr-sbin-usr-local-bin-usr-local




                • Do NOT use /bin or /sbin. Reserve these for binaries required to boot your system.

                • Do use /usr/bin and /usr/sbin. Most things on unbuntu live here although there are exceptions. If you are properly packaging your software (into a .dpkg or similar) then definitely use /usr/bin and /usr/sbin.

                • If you don't intend to package it properly and just want to manually copy it as a sys admin then /usr/local/bin and /usr/local/sbin are more appropriate. But this generally shouldn't be used if you are going to distribute your code to other people.

                • If some of your binaries are only ever used by your other binaries, consider putting them under /usr/lib or /usr/local/lib. It's not uncommon for binaries to be thought of as libraries


                In short, /usr/sbin and /usr/bin` were most likely correct.






                share|improve this answer












                There are many fine resources on the standards, including https://refspecs.linuxfoundation.org/FHS_3.0/fhs-3.0.pdf



                I would suggest:





                • Sockets: /run/<subdir>/. That's because /var/run is just a sym-link to /run these days on Ubuntu. /run is the newer standard place for such things.


                • Log files: /var/log/<subdir>/ Correct. Although a single log doesn't actually need a directory. Don't forget to add an /etc/logrotate.d entry as well


                • Configuration files: /etc/<subdir>/ Correct. Again a single config file doesn't need a directory but it doesn't hurt.


                The binaries:



                These are tricky there's a whole bunch of places they can exist. Generally bin is for user commands, sbin is for server daemons. Some people say sbin is for binaries executed only by root. See here: https://askubuntu.com/questions/308045/differences-between-bin-sbin-usr-bin-usr-sbin-usr-local-bin-usr-local




                • Do NOT use /bin or /sbin. Reserve these for binaries required to boot your system.

                • Do use /usr/bin and /usr/sbin. Most things on unbuntu live here although there are exceptions. If you are properly packaging your software (into a .dpkg or similar) then definitely use /usr/bin and /usr/sbin.

                • If you don't intend to package it properly and just want to manually copy it as a sys admin then /usr/local/bin and /usr/local/sbin are more appropriate. But this generally shouldn't be used if you are going to distribute your code to other people.

                • If some of your binaries are only ever used by your other binaries, consider putting them under /usr/lib or /usr/local/lib. It's not uncommon for binaries to be thought of as libraries


                In short, /usr/sbin and /usr/bin` were most likely correct.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 1 hour ago









                coulingcouling

                267210




                267210






















                    Sceptical Jule is a new contributor. Be nice, and check out our Code of Conduct.










                    draft saved

                    draft discarded


















                    Sceptical Jule is a new contributor. Be nice, and check out our Code of Conduct.













                    Sceptical Jule is a new contributor. Be nice, and check out our Code of Conduct.












                    Sceptical Jule is a new contributor. Be nice, and check out our Code of Conduct.
















                    Thanks for contributing an answer to Unix & Linux Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f493342%2fwhere-to-put-daemon-files%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

                    Entries order in /etc/network/interfaces

                    新発田市

                    Grub takes very long (several minutes) to open Menu (in Multi-Boot-System)