Autostart/restart program simply with daemontools in debian 9

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











up vote
1
down vote

favorite












For example make vlc start and play a video full screen on boot. After working this out here it is:







share|improve this question
























    up vote
    1
    down vote

    favorite












    For example make vlc start and play a video full screen on boot. After working this out here it is:







    share|improve this question






















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      For example make vlc start and play a video full screen on boot. After working this out here it is:







      share|improve this question












      For example make vlc start and play a video full screen on boot. After working this out here it is:









      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 2 at 20:31









      Hayden Thring

      1216




      1216




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          You first need the following 2 packages if not already:




          apt-get install daemontools daemontools-run




          This will install and get running the needed "monitors",
          Then you need to create the "shortcut" to your program to start/restart automatically:




          mkdir /home/user/vlc-daemon /home/user/vlc-daemon/log /home/user/vlc-daemon/log/main



          gedit /home/user/vlc-daemon/run




          put in this file and save it:



          #!/bin/sh
          echo starting vlc-d
          export DISPLAY=:0 #needed for X program
          exec setuidgid user /usr/bin/vlc -f /home/user/Downloads/myvideo.avi


          This starts vlc program in fullscreen playing myvideo.avi as user "user" , adapt as needed.



          Then, for logging: (add and save)




          gedit /home/user/vlc-daemon/log/run




          #!/bin/sh
          exec setuidgid user multilog t ./main


          Make them executable:




          chmod 755 /home/user/vlc-daemon/run /home/user vlc-daemon/log/run




          Now to install & activate service:




          update-service --add /home/user/vlc-daemon




          Now your program should be running, and start/restart automatically. for more documentation see: http://cr.yp.to/daemontools.html



          If not check log/main folder, and that you can also run /home/user/vlc-daemon/run manually from cli , also the following command can show some errors:




          ps -aux | grep readproctitle







          share|improve this answer




















          • Although good security practice is not to put system-level services in directories that unprivileged users have control over. Better practice would be to have a per-user instance of svscan running as the unprivileged user to start with; but that is more work and more complex than this. As is handling DISPLAY in a robust fashion.
            – JdeBP
            Apr 2 at 20:49










          • Well that is the way debian supplies it (svscan)?, One change i think i do need to make is delay app initial startup until later if possible, to allow more time for wifi to come up. Should i edit it and put the daemon outside home ?
            – Hayden Thring
            Apr 2 at 20:53











          • The thing to remember is that it is a toolset. You are not limited to just doing only a few things with it, and running an unprivileged svscan out of, say, $HOME/.config/service is after all just a matter of another service to setuidgid and do so.
            – JdeBP
            Apr 2 at 21:02










          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%2f435127%2fautostart-restart-program-simply-with-daemontools-in-debian-9%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
          1
          down vote













          You first need the following 2 packages if not already:




          apt-get install daemontools daemontools-run




          This will install and get running the needed "monitors",
          Then you need to create the "shortcut" to your program to start/restart automatically:




          mkdir /home/user/vlc-daemon /home/user/vlc-daemon/log /home/user/vlc-daemon/log/main



          gedit /home/user/vlc-daemon/run




          put in this file and save it:



          #!/bin/sh
          echo starting vlc-d
          export DISPLAY=:0 #needed for X program
          exec setuidgid user /usr/bin/vlc -f /home/user/Downloads/myvideo.avi


          This starts vlc program in fullscreen playing myvideo.avi as user "user" , adapt as needed.



          Then, for logging: (add and save)




          gedit /home/user/vlc-daemon/log/run




          #!/bin/sh
          exec setuidgid user multilog t ./main


          Make them executable:




          chmod 755 /home/user/vlc-daemon/run /home/user vlc-daemon/log/run




          Now to install & activate service:




          update-service --add /home/user/vlc-daemon




          Now your program should be running, and start/restart automatically. for more documentation see: http://cr.yp.to/daemontools.html



          If not check log/main folder, and that you can also run /home/user/vlc-daemon/run manually from cli , also the following command can show some errors:




          ps -aux | grep readproctitle







          share|improve this answer




















          • Although good security practice is not to put system-level services in directories that unprivileged users have control over. Better practice would be to have a per-user instance of svscan running as the unprivileged user to start with; but that is more work and more complex than this. As is handling DISPLAY in a robust fashion.
            – JdeBP
            Apr 2 at 20:49










          • Well that is the way debian supplies it (svscan)?, One change i think i do need to make is delay app initial startup until later if possible, to allow more time for wifi to come up. Should i edit it and put the daemon outside home ?
            – Hayden Thring
            Apr 2 at 20:53











          • The thing to remember is that it is a toolset. You are not limited to just doing only a few things with it, and running an unprivileged svscan out of, say, $HOME/.config/service is after all just a matter of another service to setuidgid and do so.
            – JdeBP
            Apr 2 at 21:02














          up vote
          1
          down vote













          You first need the following 2 packages if not already:




          apt-get install daemontools daemontools-run




          This will install and get running the needed "monitors",
          Then you need to create the "shortcut" to your program to start/restart automatically:




          mkdir /home/user/vlc-daemon /home/user/vlc-daemon/log /home/user/vlc-daemon/log/main



          gedit /home/user/vlc-daemon/run




          put in this file and save it:



          #!/bin/sh
          echo starting vlc-d
          export DISPLAY=:0 #needed for X program
          exec setuidgid user /usr/bin/vlc -f /home/user/Downloads/myvideo.avi


          This starts vlc program in fullscreen playing myvideo.avi as user "user" , adapt as needed.



          Then, for logging: (add and save)




          gedit /home/user/vlc-daemon/log/run




          #!/bin/sh
          exec setuidgid user multilog t ./main


          Make them executable:




          chmod 755 /home/user/vlc-daemon/run /home/user vlc-daemon/log/run




          Now to install & activate service:




          update-service --add /home/user/vlc-daemon




          Now your program should be running, and start/restart automatically. for more documentation see: http://cr.yp.to/daemontools.html



          If not check log/main folder, and that you can also run /home/user/vlc-daemon/run manually from cli , also the following command can show some errors:




          ps -aux | grep readproctitle







          share|improve this answer




















          • Although good security practice is not to put system-level services in directories that unprivileged users have control over. Better practice would be to have a per-user instance of svscan running as the unprivileged user to start with; but that is more work and more complex than this. As is handling DISPLAY in a robust fashion.
            – JdeBP
            Apr 2 at 20:49










          • Well that is the way debian supplies it (svscan)?, One change i think i do need to make is delay app initial startup until later if possible, to allow more time for wifi to come up. Should i edit it and put the daemon outside home ?
            – Hayden Thring
            Apr 2 at 20:53











          • The thing to remember is that it is a toolset. You are not limited to just doing only a few things with it, and running an unprivileged svscan out of, say, $HOME/.config/service is after all just a matter of another service to setuidgid and do so.
            – JdeBP
            Apr 2 at 21:02












          up vote
          1
          down vote










          up vote
          1
          down vote









          You first need the following 2 packages if not already:




          apt-get install daemontools daemontools-run




          This will install and get running the needed "monitors",
          Then you need to create the "shortcut" to your program to start/restart automatically:




          mkdir /home/user/vlc-daemon /home/user/vlc-daemon/log /home/user/vlc-daemon/log/main



          gedit /home/user/vlc-daemon/run




          put in this file and save it:



          #!/bin/sh
          echo starting vlc-d
          export DISPLAY=:0 #needed for X program
          exec setuidgid user /usr/bin/vlc -f /home/user/Downloads/myvideo.avi


          This starts vlc program in fullscreen playing myvideo.avi as user "user" , adapt as needed.



          Then, for logging: (add and save)




          gedit /home/user/vlc-daemon/log/run




          #!/bin/sh
          exec setuidgid user multilog t ./main


          Make them executable:




          chmod 755 /home/user/vlc-daemon/run /home/user vlc-daemon/log/run




          Now to install & activate service:




          update-service --add /home/user/vlc-daemon




          Now your program should be running, and start/restart automatically. for more documentation see: http://cr.yp.to/daemontools.html



          If not check log/main folder, and that you can also run /home/user/vlc-daemon/run manually from cli , also the following command can show some errors:




          ps -aux | grep readproctitle







          share|improve this answer












          You first need the following 2 packages if not already:




          apt-get install daemontools daemontools-run




          This will install and get running the needed "monitors",
          Then you need to create the "shortcut" to your program to start/restart automatically:




          mkdir /home/user/vlc-daemon /home/user/vlc-daemon/log /home/user/vlc-daemon/log/main



          gedit /home/user/vlc-daemon/run




          put in this file and save it:



          #!/bin/sh
          echo starting vlc-d
          export DISPLAY=:0 #needed for X program
          exec setuidgid user /usr/bin/vlc -f /home/user/Downloads/myvideo.avi


          This starts vlc program in fullscreen playing myvideo.avi as user "user" , adapt as needed.



          Then, for logging: (add and save)




          gedit /home/user/vlc-daemon/log/run




          #!/bin/sh
          exec setuidgid user multilog t ./main


          Make them executable:




          chmod 755 /home/user/vlc-daemon/run /home/user vlc-daemon/log/run




          Now to install & activate service:




          update-service --add /home/user/vlc-daemon




          Now your program should be running, and start/restart automatically. for more documentation see: http://cr.yp.to/daemontools.html



          If not check log/main folder, and that you can also run /home/user/vlc-daemon/run manually from cli , also the following command can show some errors:




          ps -aux | grep readproctitle








          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 2 at 20:31









          Hayden Thring

          1216




          1216











          • Although good security practice is not to put system-level services in directories that unprivileged users have control over. Better practice would be to have a per-user instance of svscan running as the unprivileged user to start with; but that is more work and more complex than this. As is handling DISPLAY in a robust fashion.
            – JdeBP
            Apr 2 at 20:49










          • Well that is the way debian supplies it (svscan)?, One change i think i do need to make is delay app initial startup until later if possible, to allow more time for wifi to come up. Should i edit it and put the daemon outside home ?
            – Hayden Thring
            Apr 2 at 20:53











          • The thing to remember is that it is a toolset. You are not limited to just doing only a few things with it, and running an unprivileged svscan out of, say, $HOME/.config/service is after all just a matter of another service to setuidgid and do so.
            – JdeBP
            Apr 2 at 21:02
















          • Although good security practice is not to put system-level services in directories that unprivileged users have control over. Better practice would be to have a per-user instance of svscan running as the unprivileged user to start with; but that is more work and more complex than this. As is handling DISPLAY in a robust fashion.
            – JdeBP
            Apr 2 at 20:49










          • Well that is the way debian supplies it (svscan)?, One change i think i do need to make is delay app initial startup until later if possible, to allow more time for wifi to come up. Should i edit it and put the daemon outside home ?
            – Hayden Thring
            Apr 2 at 20:53











          • The thing to remember is that it is a toolset. You are not limited to just doing only a few things with it, and running an unprivileged svscan out of, say, $HOME/.config/service is after all just a matter of another service to setuidgid and do so.
            – JdeBP
            Apr 2 at 21:02















          Although good security practice is not to put system-level services in directories that unprivileged users have control over. Better practice would be to have a per-user instance of svscan running as the unprivileged user to start with; but that is more work and more complex than this. As is handling DISPLAY in a robust fashion.
          – JdeBP
          Apr 2 at 20:49




          Although good security practice is not to put system-level services in directories that unprivileged users have control over. Better practice would be to have a per-user instance of svscan running as the unprivileged user to start with; but that is more work and more complex than this. As is handling DISPLAY in a robust fashion.
          – JdeBP
          Apr 2 at 20:49












          Well that is the way debian supplies it (svscan)?, One change i think i do need to make is delay app initial startup until later if possible, to allow more time for wifi to come up. Should i edit it and put the daemon outside home ?
          – Hayden Thring
          Apr 2 at 20:53





          Well that is the way debian supplies it (svscan)?, One change i think i do need to make is delay app initial startup until later if possible, to allow more time for wifi to come up. Should i edit it and put the daemon outside home ?
          – Hayden Thring
          Apr 2 at 20:53













          The thing to remember is that it is a toolset. You are not limited to just doing only a few things with it, and running an unprivileged svscan out of, say, $HOME/.config/service is after all just a matter of another service to setuidgid and do so.
          – JdeBP
          Apr 2 at 21:02




          The thing to remember is that it is a toolset. You are not limited to just doing only a few things with it, and running an unprivileged svscan out of, say, $HOME/.config/service is after all just a matter of another service to setuidgid and do so.
          – JdeBP
          Apr 2 at 21:02












           

          draft saved


          draft discarded


























           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f435127%2fautostart-restart-program-simply-with-daemontools-in-debian-9%23new-answer', 'question_page');

          );

          Post as a guest













































































          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