What is the difference between shutdown 18:00 and at 18:00 shutdown?

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











up vote
28
down vote

favorite
4












at 18:00 shutdown now and shutdown 18:00 , are they starting the same service? Do they work the same way?







share|improve this question
























    up vote
    28
    down vote

    favorite
    4












    at 18:00 shutdown now and shutdown 18:00 , are they starting the same service? Do they work the same way?







    share|improve this question






















      up vote
      28
      down vote

      favorite
      4









      up vote
      28
      down vote

      favorite
      4






      4





      at 18:00 shutdown now and shutdown 18:00 , are they starting the same service? Do they work the same way?







      share|improve this question












      at 18:00 shutdown now and shutdown 18:00 , are they starting the same service? Do they work the same way?









      share|improve this question











      share|improve this question




      share|improve this question










      asked Aug 28 at 14:28









      yang

      14325




      14325




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          45
          down vote



          accepted










          at 18:00 shutdown now creates an "at" job, which is performed at the specified time by the at daemon or perhaps the cron daemon, depending on your system.



          shutdown 18:00 starts a process in your shell that waits until the specified time and then performs the shutdown. This command can be terminated if e.g. your shell session is terminated.



          The net result in most cases will be the same: the system is shutdown at 18:00.



          One difference is that if you use at, the job will be stored and if the system is shutdown by some other means before 18:00, upon booting again the job will still be waiting to be run; if the time is already passed, the shutdown will be performed immediately which could be quite unexpected.



          Another difference is that shutdown 18:00 will create a /run/nologin file 5 minutes before the scheduled time to prevent people logging in after that moment. Also broadcast messages will be sent to warn logged in users that the system is about to be shutdown.



          You need to take account these differences to decide which to use.






          share|improve this answer
















          • 1




            "shutdown 18:00 starts a process in your shell that waits". What if you log out before then?
            – RonJohn
            Aug 28 at 18:46







          • 1




            @RonJohn: Then it depends if you used nohup or disown or whatever, if logging out normally kills running background processes. Different systems can have different defaults for that. (I'm assuming that there really is a sudo shutdown process still running, rather it just signalling init to start a shutdown timer. The latter might actually be what happens, but I haven't checked recently. Oh, but @JdeBP has; see that answer)
            – Peter Cordes
            Aug 29 at 5:02











          • Is it really possible to set up at so it works via cron instead of atd?
            – terdon♦
            Aug 29 at 8:25






          • 3




            There's a diamond moderator who has not read How to Ask. (-: You will find that this question was asked four years ago at unix.stackexchange.com/questions/147643 .
            – JdeBP
            Aug 29 at 10:17










          • "Also broadcast messages will be sent to warn logged in users that the system is about to be shutdown." I'd say this is the most important difference in servers that have many users, I would highlight it more in this answer.
            – JiK
            Aug 30 at 10:21

















          up vote
          22
          down vote













          And now, the systemd answer.



          If you have CentOS 7, you have a systemd operating system and the answer is different.



          at 18:00 shutdown now still schedules via the at subsystem, but that shutdown command, as well as the one that you invoke directly with shutdown 18:00, is different. It's actually systemd's systemctl program. systemctl does things differently.



          First of all, systemctl sends the scheduled shutdown request off to be processed by a dæmon, pretty much like in the at case. This is a systemd dæmon, though, specifically logind (the systemd-shutdownd dæmon having been removed from systemd in May 2015, which change has since percolated through to later minor versions of CentOS 7), not the at subsystem. systemctl speaks an internal protocol to a (system-wide) Desktop Bus broker which in turn communicates with logind.



          So, like in the at case, there's no shutdown process sitting there counting down and spawning the wall messages. So one can log out and this will not affect the schedule, and cancelling is not as simple as merely interrupting/killing the foreground process of the login session. Just like with at.



          There are still messages, unlike in the at case, but they are issued by logind. Also unlike the at case, the scheduled job does not persist across system restarts, so an actual shutdown cancels a scheduled one. There is a file in the filesystem, but it is under /run/systemd/shutdown which is non-persistent storage.



          Further differences are that there can be only one scheduled shutdown at a time, whereas one can submit multiple at jobs, and Policy Kit will apply rules to shutdown run in non-login-session context as an at job that are different to the rules applied to shutdown run in login-session context. The latter might be more permissive, allowing (say) an unprivileged user who is logged in to the active login session to shut down the system.



          Further reading



          • My answer to What is the difference between these commands for bringing down a Linux server?

          • Error when running `shutdown -h now`





          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',
            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%2f465322%2fwhat-is-the-difference-between-shutdown-1800-and-at-1800-shutdown%23new-answer', 'question_page');

            );

            Post as a guest






























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            45
            down vote



            accepted










            at 18:00 shutdown now creates an "at" job, which is performed at the specified time by the at daemon or perhaps the cron daemon, depending on your system.



            shutdown 18:00 starts a process in your shell that waits until the specified time and then performs the shutdown. This command can be terminated if e.g. your shell session is terminated.



            The net result in most cases will be the same: the system is shutdown at 18:00.



            One difference is that if you use at, the job will be stored and if the system is shutdown by some other means before 18:00, upon booting again the job will still be waiting to be run; if the time is already passed, the shutdown will be performed immediately which could be quite unexpected.



            Another difference is that shutdown 18:00 will create a /run/nologin file 5 minutes before the scheduled time to prevent people logging in after that moment. Also broadcast messages will be sent to warn logged in users that the system is about to be shutdown.



            You need to take account these differences to decide which to use.






            share|improve this answer
















            • 1




              "shutdown 18:00 starts a process in your shell that waits". What if you log out before then?
              – RonJohn
              Aug 28 at 18:46







            • 1




              @RonJohn: Then it depends if you used nohup or disown or whatever, if logging out normally kills running background processes. Different systems can have different defaults for that. (I'm assuming that there really is a sudo shutdown process still running, rather it just signalling init to start a shutdown timer. The latter might actually be what happens, but I haven't checked recently. Oh, but @JdeBP has; see that answer)
              – Peter Cordes
              Aug 29 at 5:02











            • Is it really possible to set up at so it works via cron instead of atd?
              – terdon♦
              Aug 29 at 8:25






            • 3




              There's a diamond moderator who has not read How to Ask. (-: You will find that this question was asked four years ago at unix.stackexchange.com/questions/147643 .
              – JdeBP
              Aug 29 at 10:17










            • "Also broadcast messages will be sent to warn logged in users that the system is about to be shutdown." I'd say this is the most important difference in servers that have many users, I would highlight it more in this answer.
              – JiK
              Aug 30 at 10:21














            up vote
            45
            down vote



            accepted










            at 18:00 shutdown now creates an "at" job, which is performed at the specified time by the at daemon or perhaps the cron daemon, depending on your system.



            shutdown 18:00 starts a process in your shell that waits until the specified time and then performs the shutdown. This command can be terminated if e.g. your shell session is terminated.



            The net result in most cases will be the same: the system is shutdown at 18:00.



            One difference is that if you use at, the job will be stored and if the system is shutdown by some other means before 18:00, upon booting again the job will still be waiting to be run; if the time is already passed, the shutdown will be performed immediately which could be quite unexpected.



            Another difference is that shutdown 18:00 will create a /run/nologin file 5 minutes before the scheduled time to prevent people logging in after that moment. Also broadcast messages will be sent to warn logged in users that the system is about to be shutdown.



            You need to take account these differences to decide which to use.






            share|improve this answer
















            • 1




              "shutdown 18:00 starts a process in your shell that waits". What if you log out before then?
              – RonJohn
              Aug 28 at 18:46







            • 1




              @RonJohn: Then it depends if you used nohup or disown or whatever, if logging out normally kills running background processes. Different systems can have different defaults for that. (I'm assuming that there really is a sudo shutdown process still running, rather it just signalling init to start a shutdown timer. The latter might actually be what happens, but I haven't checked recently. Oh, but @JdeBP has; see that answer)
              – Peter Cordes
              Aug 29 at 5:02











            • Is it really possible to set up at so it works via cron instead of atd?
              – terdon♦
              Aug 29 at 8:25






            • 3




              There's a diamond moderator who has not read How to Ask. (-: You will find that this question was asked four years ago at unix.stackexchange.com/questions/147643 .
              – JdeBP
              Aug 29 at 10:17










            • "Also broadcast messages will be sent to warn logged in users that the system is about to be shutdown." I'd say this is the most important difference in servers that have many users, I would highlight it more in this answer.
              – JiK
              Aug 30 at 10:21












            up vote
            45
            down vote



            accepted







            up vote
            45
            down vote



            accepted






            at 18:00 shutdown now creates an "at" job, which is performed at the specified time by the at daemon or perhaps the cron daemon, depending on your system.



            shutdown 18:00 starts a process in your shell that waits until the specified time and then performs the shutdown. This command can be terminated if e.g. your shell session is terminated.



            The net result in most cases will be the same: the system is shutdown at 18:00.



            One difference is that if you use at, the job will be stored and if the system is shutdown by some other means before 18:00, upon booting again the job will still be waiting to be run; if the time is already passed, the shutdown will be performed immediately which could be quite unexpected.



            Another difference is that shutdown 18:00 will create a /run/nologin file 5 minutes before the scheduled time to prevent people logging in after that moment. Also broadcast messages will be sent to warn logged in users that the system is about to be shutdown.



            You need to take account these differences to decide which to use.






            share|improve this answer












            at 18:00 shutdown now creates an "at" job, which is performed at the specified time by the at daemon or perhaps the cron daemon, depending on your system.



            shutdown 18:00 starts a process in your shell that waits until the specified time and then performs the shutdown. This command can be terminated if e.g. your shell session is terminated.



            The net result in most cases will be the same: the system is shutdown at 18:00.



            One difference is that if you use at, the job will be stored and if the system is shutdown by some other means before 18:00, upon booting again the job will still be waiting to be run; if the time is already passed, the shutdown will be performed immediately which could be quite unexpected.



            Another difference is that shutdown 18:00 will create a /run/nologin file 5 minutes before the scheduled time to prevent people logging in after that moment. Also broadcast messages will be sent to warn logged in users that the system is about to be shutdown.



            You need to take account these differences to decide which to use.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Aug 28 at 14:36









            wurtel

            9,32511224




            9,32511224







            • 1




              "shutdown 18:00 starts a process in your shell that waits". What if you log out before then?
              – RonJohn
              Aug 28 at 18:46







            • 1




              @RonJohn: Then it depends if you used nohup or disown or whatever, if logging out normally kills running background processes. Different systems can have different defaults for that. (I'm assuming that there really is a sudo shutdown process still running, rather it just signalling init to start a shutdown timer. The latter might actually be what happens, but I haven't checked recently. Oh, but @JdeBP has; see that answer)
              – Peter Cordes
              Aug 29 at 5:02











            • Is it really possible to set up at so it works via cron instead of atd?
              – terdon♦
              Aug 29 at 8:25






            • 3




              There's a diamond moderator who has not read How to Ask. (-: You will find that this question was asked four years ago at unix.stackexchange.com/questions/147643 .
              – JdeBP
              Aug 29 at 10:17










            • "Also broadcast messages will be sent to warn logged in users that the system is about to be shutdown." I'd say this is the most important difference in servers that have many users, I would highlight it more in this answer.
              – JiK
              Aug 30 at 10:21












            • 1




              "shutdown 18:00 starts a process in your shell that waits". What if you log out before then?
              – RonJohn
              Aug 28 at 18:46







            • 1




              @RonJohn: Then it depends if you used nohup or disown or whatever, if logging out normally kills running background processes. Different systems can have different defaults for that. (I'm assuming that there really is a sudo shutdown process still running, rather it just signalling init to start a shutdown timer. The latter might actually be what happens, but I haven't checked recently. Oh, but @JdeBP has; see that answer)
              – Peter Cordes
              Aug 29 at 5:02











            • Is it really possible to set up at so it works via cron instead of atd?
              – terdon♦
              Aug 29 at 8:25






            • 3




              There's a diamond moderator who has not read How to Ask. (-: You will find that this question was asked four years ago at unix.stackexchange.com/questions/147643 .
              – JdeBP
              Aug 29 at 10:17










            • "Also broadcast messages will be sent to warn logged in users that the system is about to be shutdown." I'd say this is the most important difference in servers that have many users, I would highlight it more in this answer.
              – JiK
              Aug 30 at 10:21







            1




            1




            "shutdown 18:00 starts a process in your shell that waits". What if you log out before then?
            – RonJohn
            Aug 28 at 18:46





            "shutdown 18:00 starts a process in your shell that waits". What if you log out before then?
            – RonJohn
            Aug 28 at 18:46





            1




            1




            @RonJohn: Then it depends if you used nohup or disown or whatever, if logging out normally kills running background processes. Different systems can have different defaults for that. (I'm assuming that there really is a sudo shutdown process still running, rather it just signalling init to start a shutdown timer. The latter might actually be what happens, but I haven't checked recently. Oh, but @JdeBP has; see that answer)
            – Peter Cordes
            Aug 29 at 5:02





            @RonJohn: Then it depends if you used nohup or disown or whatever, if logging out normally kills running background processes. Different systems can have different defaults for that. (I'm assuming that there really is a sudo shutdown process still running, rather it just signalling init to start a shutdown timer. The latter might actually be what happens, but I haven't checked recently. Oh, but @JdeBP has; see that answer)
            – Peter Cordes
            Aug 29 at 5:02













            Is it really possible to set up at so it works via cron instead of atd?
            – terdon♦
            Aug 29 at 8:25




            Is it really possible to set up at so it works via cron instead of atd?
            – terdon♦
            Aug 29 at 8:25




            3




            3




            There's a diamond moderator who has not read How to Ask. (-: You will find that this question was asked four years ago at unix.stackexchange.com/questions/147643 .
            – JdeBP
            Aug 29 at 10:17




            There's a diamond moderator who has not read How to Ask. (-: You will find that this question was asked four years ago at unix.stackexchange.com/questions/147643 .
            – JdeBP
            Aug 29 at 10:17












            "Also broadcast messages will be sent to warn logged in users that the system is about to be shutdown." I'd say this is the most important difference in servers that have many users, I would highlight it more in this answer.
            – JiK
            Aug 30 at 10:21




            "Also broadcast messages will be sent to warn logged in users that the system is about to be shutdown." I'd say this is the most important difference in servers that have many users, I would highlight it more in this answer.
            – JiK
            Aug 30 at 10:21












            up vote
            22
            down vote













            And now, the systemd answer.



            If you have CentOS 7, you have a systemd operating system and the answer is different.



            at 18:00 shutdown now still schedules via the at subsystem, but that shutdown command, as well as the one that you invoke directly with shutdown 18:00, is different. It's actually systemd's systemctl program. systemctl does things differently.



            First of all, systemctl sends the scheduled shutdown request off to be processed by a dæmon, pretty much like in the at case. This is a systemd dæmon, though, specifically logind (the systemd-shutdownd dæmon having been removed from systemd in May 2015, which change has since percolated through to later minor versions of CentOS 7), not the at subsystem. systemctl speaks an internal protocol to a (system-wide) Desktop Bus broker which in turn communicates with logind.



            So, like in the at case, there's no shutdown process sitting there counting down and spawning the wall messages. So one can log out and this will not affect the schedule, and cancelling is not as simple as merely interrupting/killing the foreground process of the login session. Just like with at.



            There are still messages, unlike in the at case, but they are issued by logind. Also unlike the at case, the scheduled job does not persist across system restarts, so an actual shutdown cancels a scheduled one. There is a file in the filesystem, but it is under /run/systemd/shutdown which is non-persistent storage.



            Further differences are that there can be only one scheduled shutdown at a time, whereas one can submit multiple at jobs, and Policy Kit will apply rules to shutdown run in non-login-session context as an at job that are different to the rules applied to shutdown run in login-session context. The latter might be more permissive, allowing (say) an unprivileged user who is logged in to the active login session to shut down the system.



            Further reading



            • My answer to What is the difference between these commands for bringing down a Linux server?

            • Error when running `shutdown -h now`





            share|improve this answer


























              up vote
              22
              down vote













              And now, the systemd answer.



              If you have CentOS 7, you have a systemd operating system and the answer is different.



              at 18:00 shutdown now still schedules via the at subsystem, but that shutdown command, as well as the one that you invoke directly with shutdown 18:00, is different. It's actually systemd's systemctl program. systemctl does things differently.



              First of all, systemctl sends the scheduled shutdown request off to be processed by a dæmon, pretty much like in the at case. This is a systemd dæmon, though, specifically logind (the systemd-shutdownd dæmon having been removed from systemd in May 2015, which change has since percolated through to later minor versions of CentOS 7), not the at subsystem. systemctl speaks an internal protocol to a (system-wide) Desktop Bus broker which in turn communicates with logind.



              So, like in the at case, there's no shutdown process sitting there counting down and spawning the wall messages. So one can log out and this will not affect the schedule, and cancelling is not as simple as merely interrupting/killing the foreground process of the login session. Just like with at.



              There are still messages, unlike in the at case, but they are issued by logind. Also unlike the at case, the scheduled job does not persist across system restarts, so an actual shutdown cancels a scheduled one. There is a file in the filesystem, but it is under /run/systemd/shutdown which is non-persistent storage.



              Further differences are that there can be only one scheduled shutdown at a time, whereas one can submit multiple at jobs, and Policy Kit will apply rules to shutdown run in non-login-session context as an at job that are different to the rules applied to shutdown run in login-session context. The latter might be more permissive, allowing (say) an unprivileged user who is logged in to the active login session to shut down the system.



              Further reading



              • My answer to What is the difference between these commands for bringing down a Linux server?

              • Error when running `shutdown -h now`





              share|improve this answer
























                up vote
                22
                down vote










                up vote
                22
                down vote









                And now, the systemd answer.



                If you have CentOS 7, you have a systemd operating system and the answer is different.



                at 18:00 shutdown now still schedules via the at subsystem, but that shutdown command, as well as the one that you invoke directly with shutdown 18:00, is different. It's actually systemd's systemctl program. systemctl does things differently.



                First of all, systemctl sends the scheduled shutdown request off to be processed by a dæmon, pretty much like in the at case. This is a systemd dæmon, though, specifically logind (the systemd-shutdownd dæmon having been removed from systemd in May 2015, which change has since percolated through to later minor versions of CentOS 7), not the at subsystem. systemctl speaks an internal protocol to a (system-wide) Desktop Bus broker which in turn communicates with logind.



                So, like in the at case, there's no shutdown process sitting there counting down and spawning the wall messages. So one can log out and this will not affect the schedule, and cancelling is not as simple as merely interrupting/killing the foreground process of the login session. Just like with at.



                There are still messages, unlike in the at case, but they are issued by logind. Also unlike the at case, the scheduled job does not persist across system restarts, so an actual shutdown cancels a scheduled one. There is a file in the filesystem, but it is under /run/systemd/shutdown which is non-persistent storage.



                Further differences are that there can be only one scheduled shutdown at a time, whereas one can submit multiple at jobs, and Policy Kit will apply rules to shutdown run in non-login-session context as an at job that are different to the rules applied to shutdown run in login-session context. The latter might be more permissive, allowing (say) an unprivileged user who is logged in to the active login session to shut down the system.



                Further reading



                • My answer to What is the difference between these commands for bringing down a Linux server?

                • Error when running `shutdown -h now`





                share|improve this answer














                And now, the systemd answer.



                If you have CentOS 7, you have a systemd operating system and the answer is different.



                at 18:00 shutdown now still schedules via the at subsystem, but that shutdown command, as well as the one that you invoke directly with shutdown 18:00, is different. It's actually systemd's systemctl program. systemctl does things differently.



                First of all, systemctl sends the scheduled shutdown request off to be processed by a dæmon, pretty much like in the at case. This is a systemd dæmon, though, specifically logind (the systemd-shutdownd dæmon having been removed from systemd in May 2015, which change has since percolated through to later minor versions of CentOS 7), not the at subsystem. systemctl speaks an internal protocol to a (system-wide) Desktop Bus broker which in turn communicates with logind.



                So, like in the at case, there's no shutdown process sitting there counting down and spawning the wall messages. So one can log out and this will not affect the schedule, and cancelling is not as simple as merely interrupting/killing the foreground process of the login session. Just like with at.



                There are still messages, unlike in the at case, but they are issued by logind. Also unlike the at case, the scheduled job does not persist across system restarts, so an actual shutdown cancels a scheduled one. There is a file in the filesystem, but it is under /run/systemd/shutdown which is non-persistent storage.



                Further differences are that there can be only one scheduled shutdown at a time, whereas one can submit multiple at jobs, and Policy Kit will apply rules to shutdown run in non-login-session context as an at job that are different to the rules applied to shutdown run in login-session context. The latter might be more permissive, allowing (say) an unprivileged user who is logged in to the active login session to shut down the system.



                Further reading



                • My answer to What is the difference between these commands for bringing down a Linux server?

                • Error when running `shutdown -h now`






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Aug 29 at 11:08









                Michael Kjörling

                15.8k74597




                15.8k74597










                answered Aug 28 at 15:58









                JdeBP

                29.1k459135




                29.1k459135



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f465322%2fwhat-is-the-difference-between-shutdown-1800-and-at-1800-shutdown%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    這個網誌中的熱門文章

                    How to combine Bézier curves to a surface?

                    Mutual Information Always Non-negative

                    Why am i infinitely getting the same tweet with the Twitter Search API?