Add poweroff to startup script












0














I want to add poweroff to startup script /etc/rc.local (Ubuntu). It sounds odd or silly, the reason is I want to tease my friend for few minutes. I didn't tried it up to now.



Question:




  1. Does the system really shutdown after startup?

  2. If above case is true, how to stop it?

  3. Is this really dangerous?










share|improve this question




















  • 2




    Pulling a prank is only funny if the person pranked upon can laugh about it. Just assuming that this works, if you or your friend do not know how to prevent the system from shutting down after the "novelty of the prank has faded", then you should not do this. In that case I would consider this dangerous, especially if your friend relies for work or other non-fun-only activities on his/her computer.
    – Anthon
    May 30 '14 at 10:15










  • Isn't there any other way to prank him? :P
    – Amith KK
    May 30 '14 at 13:28










  • Okay, I understand. I'm not going to do this.
    – gangadhars
    May 30 '14 at 13:30
















0














I want to add poweroff to startup script /etc/rc.local (Ubuntu). It sounds odd or silly, the reason is I want to tease my friend for few minutes. I didn't tried it up to now.



Question:




  1. Does the system really shutdown after startup?

  2. If above case is true, how to stop it?

  3. Is this really dangerous?










share|improve this question




















  • 2




    Pulling a prank is only funny if the person pranked upon can laugh about it. Just assuming that this works, if you or your friend do not know how to prevent the system from shutting down after the "novelty of the prank has faded", then you should not do this. In that case I would consider this dangerous, especially if your friend relies for work or other non-fun-only activities on his/her computer.
    – Anthon
    May 30 '14 at 10:15










  • Isn't there any other way to prank him? :P
    – Amith KK
    May 30 '14 at 13:28










  • Okay, I understand. I'm not going to do this.
    – gangadhars
    May 30 '14 at 13:30














0












0








0







I want to add poweroff to startup script /etc/rc.local (Ubuntu). It sounds odd or silly, the reason is I want to tease my friend for few minutes. I didn't tried it up to now.



Question:




  1. Does the system really shutdown after startup?

  2. If above case is true, how to stop it?

  3. Is this really dangerous?










share|improve this question















I want to add poweroff to startup script /etc/rc.local (Ubuntu). It sounds odd or silly, the reason is I want to tease my friend for few minutes. I didn't tried it up to now.



Question:




  1. Does the system really shutdown after startup?

  2. If above case is true, how to stop it?

  3. Is this really dangerous?







ubuntu startup






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 20 '18 at 0:16









Rui F Ribeiro

39k1479130




39k1479130










asked May 30 '14 at 9:32









gangadhars

3472921




3472921








  • 2




    Pulling a prank is only funny if the person pranked upon can laugh about it. Just assuming that this works, if you or your friend do not know how to prevent the system from shutting down after the "novelty of the prank has faded", then you should not do this. In that case I would consider this dangerous, especially if your friend relies for work or other non-fun-only activities on his/her computer.
    – Anthon
    May 30 '14 at 10:15










  • Isn't there any other way to prank him? :P
    – Amith KK
    May 30 '14 at 13:28










  • Okay, I understand. I'm not going to do this.
    – gangadhars
    May 30 '14 at 13:30














  • 2




    Pulling a prank is only funny if the person pranked upon can laugh about it. Just assuming that this works, if you or your friend do not know how to prevent the system from shutting down after the "novelty of the prank has faded", then you should not do this. In that case I would consider this dangerous, especially if your friend relies for work or other non-fun-only activities on his/her computer.
    – Anthon
    May 30 '14 at 10:15










  • Isn't there any other way to prank him? :P
    – Amith KK
    May 30 '14 at 13:28










  • Okay, I understand. I'm not going to do this.
    – gangadhars
    May 30 '14 at 13:30








2




2




Pulling a prank is only funny if the person pranked upon can laugh about it. Just assuming that this works, if you or your friend do not know how to prevent the system from shutting down after the "novelty of the prank has faded", then you should not do this. In that case I would consider this dangerous, especially if your friend relies for work or other non-fun-only activities on his/her computer.
– Anthon
May 30 '14 at 10:15




Pulling a prank is only funny if the person pranked upon can laugh about it. Just assuming that this works, if you or your friend do not know how to prevent the system from shutting down after the "novelty of the prank has faded", then you should not do this. In that case I would consider this dangerous, especially if your friend relies for work or other non-fun-only activities on his/her computer.
– Anthon
May 30 '14 at 10:15












Isn't there any other way to prank him? :P
– Amith KK
May 30 '14 at 13:28




Isn't there any other way to prank him? :P
– Amith KK
May 30 '14 at 13:28












Okay, I understand. I'm not going to do this.
– gangadhars
May 30 '14 at 13:30




Okay, I understand. I'm not going to do this.
– gangadhars
May 30 '14 at 13:30










2 Answers
2






active

oldest

votes


















0














You can put a sleep command before poweroff.
For example:



sleep 300; poweroff



This way you will have 5 minutes before the poweroff. When you want to stop this, you can use these 5 minutes to login to the system and remove the poweroff command from the init script.



Another way would be to add init=/bin/sh to the kernel parameters upon booting (in the bootloader), when you want to stop this. Then only the kernel will be booted and no init scripts will be ran. You will endup in root shell. Since no scripts were ran you will need to remount your RootFS with RW, like this: mount -o remount,rw / then remove the init script, sync the FS and reboot.



I would use the first option, it's more safer if you don't know what to do.






share|improve this answer





























    0














    Strictly speaking, it will shutdown as part of the startup process. If there are services running on that box that don't like being forcibly shutdown while they're still starting up, it might be dangerous.



    If you've successfully managed to insert an unguarded poweroff in the startup process, my "usual" way to fix it would be to boot into a live system from a rescue medium, mount the root partition, fix the startup script, remove all your files and access rights and think about a suitable punishment for you.






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


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f132678%2fadd-poweroff-to-startup-script%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














      You can put a sleep command before poweroff.
      For example:



      sleep 300; poweroff



      This way you will have 5 minutes before the poweroff. When you want to stop this, you can use these 5 minutes to login to the system and remove the poweroff command from the init script.



      Another way would be to add init=/bin/sh to the kernel parameters upon booting (in the bootloader), when you want to stop this. Then only the kernel will be booted and no init scripts will be ran. You will endup in root shell. Since no scripts were ran you will need to remount your RootFS with RW, like this: mount -o remount,rw / then remove the init script, sync the FS and reboot.



      I would use the first option, it's more safer if you don't know what to do.






      share|improve this answer


























        0














        You can put a sleep command before poweroff.
        For example:



        sleep 300; poweroff



        This way you will have 5 minutes before the poweroff. When you want to stop this, you can use these 5 minutes to login to the system and remove the poweroff command from the init script.



        Another way would be to add init=/bin/sh to the kernel parameters upon booting (in the bootloader), when you want to stop this. Then only the kernel will be booted and no init scripts will be ran. You will endup in root shell. Since no scripts were ran you will need to remount your RootFS with RW, like this: mount -o remount,rw / then remove the init script, sync the FS and reboot.



        I would use the first option, it's more safer if you don't know what to do.






        share|improve this answer
























          0












          0








          0






          You can put a sleep command before poweroff.
          For example:



          sleep 300; poweroff



          This way you will have 5 minutes before the poweroff. When you want to stop this, you can use these 5 minutes to login to the system and remove the poweroff command from the init script.



          Another way would be to add init=/bin/sh to the kernel parameters upon booting (in the bootloader), when you want to stop this. Then only the kernel will be booted and no init scripts will be ran. You will endup in root shell. Since no scripts were ran you will need to remount your RootFS with RW, like this: mount -o remount,rw / then remove the init script, sync the FS and reboot.



          I would use the first option, it's more safer if you don't know what to do.






          share|improve this answer












          You can put a sleep command before poweroff.
          For example:



          sleep 300; poweroff



          This way you will have 5 minutes before the poweroff. When you want to stop this, you can use these 5 minutes to login to the system and remove the poweroff command from the init script.



          Another way would be to add init=/bin/sh to the kernel parameters upon booting (in the bootloader), when you want to stop this. Then only the kernel will be booted and no init scripts will be ran. You will endup in root shell. Since no scripts were ran you will need to remount your RootFS with RW, like this: mount -o remount,rw / then remove the init script, sync the FS and reboot.



          I would use the first option, it's more safer if you don't know what to do.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered May 30 '14 at 17:12









          0xAF

          1,01698




          1,01698

























              0














              Strictly speaking, it will shutdown as part of the startup process. If there are services running on that box that don't like being forcibly shutdown while they're still starting up, it might be dangerous.



              If you've successfully managed to insert an unguarded poweroff in the startup process, my "usual" way to fix it would be to boot into a live system from a rescue medium, mount the root partition, fix the startup script, remove all your files and access rights and think about a suitable punishment for you.






              share|improve this answer


























                0














                Strictly speaking, it will shutdown as part of the startup process. If there are services running on that box that don't like being forcibly shutdown while they're still starting up, it might be dangerous.



                If you've successfully managed to insert an unguarded poweroff in the startup process, my "usual" way to fix it would be to boot into a live system from a rescue medium, mount the root partition, fix the startup script, remove all your files and access rights and think about a suitable punishment for you.






                share|improve this answer
























                  0












                  0








                  0






                  Strictly speaking, it will shutdown as part of the startup process. If there are services running on that box that don't like being forcibly shutdown while they're still starting up, it might be dangerous.



                  If you've successfully managed to insert an unguarded poweroff in the startup process, my "usual" way to fix it would be to boot into a live system from a rescue medium, mount the root partition, fix the startup script, remove all your files and access rights and think about a suitable punishment for you.






                  share|improve this answer












                  Strictly speaking, it will shutdown as part of the startup process. If there are services running on that box that don't like being forcibly shutdown while they're still starting up, it might be dangerous.



                  If you've successfully managed to insert an unguarded poweroff in the startup process, my "usual" way to fix it would be to boot into a live system from a rescue medium, mount the root partition, fix the startup script, remove all your files and access rights and think about a suitable punishment for you.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered May 30 '14 at 12:41









                  Stefan Schmiedl

                  28113




                  28113






























                      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.





                      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%2f132678%2fadd-poweroff-to-startup-script%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

                      Morgemoulin

                      Scott Moir

                      Souastre