OpenSuse Tumbleweed: How to run a bash script on startup?

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












0















I'm trying to a run a .sh file on startup of a rPi3B+ running openSuse Tumbleweed JeOS. The script is really simple and looks like this:



node /home/user_name/path/to/the/file.js



here are two links I tried to follow:



https://forums.opensuse.org/showthread.php/428743-How-to-run-script-at-startup
https://www.suse.com/c/easy-running-scripts-boot-and-shutdown/
https://doc.opensuse.org/documentation/leap/startup/html/book.opensuse.startup/cha.adm.shell.html



How how to go about this?



Edit: I also just tried following along to this one without any luck either: https://stackoverflow.com/questions/12973777/how-to-run-a-shell-script-at-startup#12973826



My startServer script in /etc/init.d looks like this:



#!/bin/sh
# ScriptName=startServer
node /home/user-name/server.js &









share|improve this question




























    0















    I'm trying to a run a .sh file on startup of a rPi3B+ running openSuse Tumbleweed JeOS. The script is really simple and looks like this:



    node /home/user_name/path/to/the/file.js



    here are two links I tried to follow:



    https://forums.opensuse.org/showthread.php/428743-How-to-run-script-at-startup
    https://www.suse.com/c/easy-running-scripts-boot-and-shutdown/
    https://doc.opensuse.org/documentation/leap/startup/html/book.opensuse.startup/cha.adm.shell.html



    How how to go about this?



    Edit: I also just tried following along to this one without any luck either: https://stackoverflow.com/questions/12973777/how-to-run-a-shell-script-at-startup#12973826



    My startServer script in /etc/init.d looks like this:



    #!/bin/sh
    # ScriptName=startServer
    node /home/user-name/server.js &









    share|improve this question


























      0












      0








      0








      I'm trying to a run a .sh file on startup of a rPi3B+ running openSuse Tumbleweed JeOS. The script is really simple and looks like this:



      node /home/user_name/path/to/the/file.js



      here are two links I tried to follow:



      https://forums.opensuse.org/showthread.php/428743-How-to-run-script-at-startup
      https://www.suse.com/c/easy-running-scripts-boot-and-shutdown/
      https://doc.opensuse.org/documentation/leap/startup/html/book.opensuse.startup/cha.adm.shell.html



      How how to go about this?



      Edit: I also just tried following along to this one without any luck either: https://stackoverflow.com/questions/12973777/how-to-run-a-shell-script-at-startup#12973826



      My startServer script in /etc/init.d looks like this:



      #!/bin/sh
      # ScriptName=startServer
      node /home/user-name/server.js &









      share|improve this question
















      I'm trying to a run a .sh file on startup of a rPi3B+ running openSuse Tumbleweed JeOS. The script is really simple and looks like this:



      node /home/user_name/path/to/the/file.js



      here are two links I tried to follow:



      https://forums.opensuse.org/showthread.php/428743-How-to-run-script-at-startup
      https://www.suse.com/c/easy-running-scripts-boot-and-shutdown/
      https://doc.opensuse.org/documentation/leap/startup/html/book.opensuse.startup/cha.adm.shell.html



      How how to go about this?



      Edit: I also just tried following along to this one without any luck either: https://stackoverflow.com/questions/12973777/how-to-run-a-shell-script-at-startup#12973826



      My startServer script in /etc/init.d looks like this:



      #!/bin/sh
      # ScriptName=startServer
      node /home/user-name/server.js &






      bash shell-script startup






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Feb 14 at 18:46









      Rui F Ribeiro

      41.3k1481140




      41.3k1481140










      asked Feb 13 at 22:32









      EruEru

      62




      62




















          1 Answer
          1






          active

          oldest

          votes


















          0














          /etc/init.d/after.local



          create this file and from within call your script.sh
          it will execute as root.



          Otherwise you can call it via su -c '/path/yourscript.sh' username where username is whatever valid user account.



          After the system is fully booted if /etc/init.d/after.local exists then whatever is in it will be run. You can chmod 600 /etc/init.d/after.local and chown root.root /etc/init.d/after.local if you are concerned about security.



          your StartServer script in /etc/init.d looks like this:



          /etc/init.d/StartServer.sh



          it contains



          #!/bin/sh
          # ScriptName=startServer
          node /home/user-name/server.js &


          create /etc/init.d/after.local and its contents is simply



          /etc/init.d/StartServer.sh


          1. after system is fully booted, the last step [this is a suse thing] it will try to execute the file /etc/init.d/after.local if it exists

          2. you manually create /etc/init.d/after.local and put /etc/init.d/StartServer.sh in it

          3. your StartServer.sh script gets run after the system is fully booted.





          share|improve this answer

























          • Can you clarify what you mean by call from within? Do you mean to include a line in the after.local file for each .sh file? Do these .sh files need to be contained in the init.d folder? Could you perhaps give an example of what this "call looks like"? Thank you!

            – Eru
            Feb 13 at 22:49











          • added clarification to above

            – ron
            Feb 14 at 15:50











          • realize you can call anything from /etc/init.d/after.local it does not need to be a .sh script.

            – ron
            Feb 14 at 15:52











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



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f500508%2fopensuse-tumbleweed-how-to-run-a-bash-script-on-startup%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









          0














          /etc/init.d/after.local



          create this file and from within call your script.sh
          it will execute as root.



          Otherwise you can call it via su -c '/path/yourscript.sh' username where username is whatever valid user account.



          After the system is fully booted if /etc/init.d/after.local exists then whatever is in it will be run. You can chmod 600 /etc/init.d/after.local and chown root.root /etc/init.d/after.local if you are concerned about security.



          your StartServer script in /etc/init.d looks like this:



          /etc/init.d/StartServer.sh



          it contains



          #!/bin/sh
          # ScriptName=startServer
          node /home/user-name/server.js &


          create /etc/init.d/after.local and its contents is simply



          /etc/init.d/StartServer.sh


          1. after system is fully booted, the last step [this is a suse thing] it will try to execute the file /etc/init.d/after.local if it exists

          2. you manually create /etc/init.d/after.local and put /etc/init.d/StartServer.sh in it

          3. your StartServer.sh script gets run after the system is fully booted.





          share|improve this answer

























          • Can you clarify what you mean by call from within? Do you mean to include a line in the after.local file for each .sh file? Do these .sh files need to be contained in the init.d folder? Could you perhaps give an example of what this "call looks like"? Thank you!

            – Eru
            Feb 13 at 22:49











          • added clarification to above

            – ron
            Feb 14 at 15:50











          • realize you can call anything from /etc/init.d/after.local it does not need to be a .sh script.

            – ron
            Feb 14 at 15:52
















          0














          /etc/init.d/after.local



          create this file and from within call your script.sh
          it will execute as root.



          Otherwise you can call it via su -c '/path/yourscript.sh' username where username is whatever valid user account.



          After the system is fully booted if /etc/init.d/after.local exists then whatever is in it will be run. You can chmod 600 /etc/init.d/after.local and chown root.root /etc/init.d/after.local if you are concerned about security.



          your StartServer script in /etc/init.d looks like this:



          /etc/init.d/StartServer.sh



          it contains



          #!/bin/sh
          # ScriptName=startServer
          node /home/user-name/server.js &


          create /etc/init.d/after.local and its contents is simply



          /etc/init.d/StartServer.sh


          1. after system is fully booted, the last step [this is a suse thing] it will try to execute the file /etc/init.d/after.local if it exists

          2. you manually create /etc/init.d/after.local and put /etc/init.d/StartServer.sh in it

          3. your StartServer.sh script gets run after the system is fully booted.





          share|improve this answer

























          • Can you clarify what you mean by call from within? Do you mean to include a line in the after.local file for each .sh file? Do these .sh files need to be contained in the init.d folder? Could you perhaps give an example of what this "call looks like"? Thank you!

            – Eru
            Feb 13 at 22:49











          • added clarification to above

            – ron
            Feb 14 at 15:50











          • realize you can call anything from /etc/init.d/after.local it does not need to be a .sh script.

            – ron
            Feb 14 at 15:52














          0












          0








          0







          /etc/init.d/after.local



          create this file and from within call your script.sh
          it will execute as root.



          Otherwise you can call it via su -c '/path/yourscript.sh' username where username is whatever valid user account.



          After the system is fully booted if /etc/init.d/after.local exists then whatever is in it will be run. You can chmod 600 /etc/init.d/after.local and chown root.root /etc/init.d/after.local if you are concerned about security.



          your StartServer script in /etc/init.d looks like this:



          /etc/init.d/StartServer.sh



          it contains



          #!/bin/sh
          # ScriptName=startServer
          node /home/user-name/server.js &


          create /etc/init.d/after.local and its contents is simply



          /etc/init.d/StartServer.sh


          1. after system is fully booted, the last step [this is a suse thing] it will try to execute the file /etc/init.d/after.local if it exists

          2. you manually create /etc/init.d/after.local and put /etc/init.d/StartServer.sh in it

          3. your StartServer.sh script gets run after the system is fully booted.





          share|improve this answer















          /etc/init.d/after.local



          create this file and from within call your script.sh
          it will execute as root.



          Otherwise you can call it via su -c '/path/yourscript.sh' username where username is whatever valid user account.



          After the system is fully booted if /etc/init.d/after.local exists then whatever is in it will be run. You can chmod 600 /etc/init.d/after.local and chown root.root /etc/init.d/after.local if you are concerned about security.



          your StartServer script in /etc/init.d looks like this:



          /etc/init.d/StartServer.sh



          it contains



          #!/bin/sh
          # ScriptName=startServer
          node /home/user-name/server.js &


          create /etc/init.d/after.local and its contents is simply



          /etc/init.d/StartServer.sh


          1. after system is fully booted, the last step [this is a suse thing] it will try to execute the file /etc/init.d/after.local if it exists

          2. you manually create /etc/init.d/after.local and put /etc/init.d/StartServer.sh in it

          3. your StartServer.sh script gets run after the system is fully booted.






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Feb 14 at 15:49

























          answered Feb 13 at 22:39









          ronron

          1,0841816




          1,0841816












          • Can you clarify what you mean by call from within? Do you mean to include a line in the after.local file for each .sh file? Do these .sh files need to be contained in the init.d folder? Could you perhaps give an example of what this "call looks like"? Thank you!

            – Eru
            Feb 13 at 22:49











          • added clarification to above

            – ron
            Feb 14 at 15:50











          • realize you can call anything from /etc/init.d/after.local it does not need to be a .sh script.

            – ron
            Feb 14 at 15:52


















          • Can you clarify what you mean by call from within? Do you mean to include a line in the after.local file for each .sh file? Do these .sh files need to be contained in the init.d folder? Could you perhaps give an example of what this "call looks like"? Thank you!

            – Eru
            Feb 13 at 22:49











          • added clarification to above

            – ron
            Feb 14 at 15:50











          • realize you can call anything from /etc/init.d/after.local it does not need to be a .sh script.

            – ron
            Feb 14 at 15:52

















          Can you clarify what you mean by call from within? Do you mean to include a line in the after.local file for each .sh file? Do these .sh files need to be contained in the init.d folder? Could you perhaps give an example of what this "call looks like"? Thank you!

          – Eru
          Feb 13 at 22:49





          Can you clarify what you mean by call from within? Do you mean to include a line in the after.local file for each .sh file? Do these .sh files need to be contained in the init.d folder? Could you perhaps give an example of what this "call looks like"? Thank you!

          – Eru
          Feb 13 at 22:49













          added clarification to above

          – ron
          Feb 14 at 15:50





          added clarification to above

          – ron
          Feb 14 at 15:50













          realize you can call anything from /etc/init.d/after.local it does not need to be a .sh script.

          – ron
          Feb 14 at 15:52






          realize you can call anything from /etc/init.d/after.local it does not need to be a .sh script.

          – ron
          Feb 14 at 15:52


















          draft saved

          draft discarded
















































          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.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f500508%2fopensuse-tumbleweed-how-to-run-a-bash-script-on-startup%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?

          Displaying single band from multi-band raster using QGIS

          How many registers does an x86_64 CPU actually have?