Does `at` run a command later if the computer is off at the specified time?

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











up vote
17
down vote

favorite
3












I want to schedule jobs with at, but I'm not sure what happens if the computer is suspended at the specified time: Will the command be executed as soon as the computer wakes up again (like with anacron) or will it not be executed at all (like with cron)?




If you specify a job to absolutely run at a specific time and date in
the past, the job will run as soon as possible.




That's what the manpage says about that, however it doesn't quite match my case: I don't want to specify a job to run in the past, I want to run it in the future and ask how at will treat it if the computer is sleeping then.



This is not a duplicate of Run at command when computer is sleeping because this question asks whether at will wake up the computer to execute the command, neither is it a duplicate of How to prevent atd from running past jobs? because this is about how to prevent at from executing those “old” jobs (with a very good answer though!).







share|improve this question


























    up vote
    17
    down vote

    favorite
    3












    I want to schedule jobs with at, but I'm not sure what happens if the computer is suspended at the specified time: Will the command be executed as soon as the computer wakes up again (like with anacron) or will it not be executed at all (like with cron)?




    If you specify a job to absolutely run at a specific time and date in
    the past, the job will run as soon as possible.




    That's what the manpage says about that, however it doesn't quite match my case: I don't want to specify a job to run in the past, I want to run it in the future and ask how at will treat it if the computer is sleeping then.



    This is not a duplicate of Run at command when computer is sleeping because this question asks whether at will wake up the computer to execute the command, neither is it a duplicate of How to prevent atd from running past jobs? because this is about how to prevent at from executing those “old” jobs (with a very good answer though!).







    share|improve this question
























      up vote
      17
      down vote

      favorite
      3









      up vote
      17
      down vote

      favorite
      3






      3





      I want to schedule jobs with at, but I'm not sure what happens if the computer is suspended at the specified time: Will the command be executed as soon as the computer wakes up again (like with anacron) or will it not be executed at all (like with cron)?




      If you specify a job to absolutely run at a specific time and date in
      the past, the job will run as soon as possible.




      That's what the manpage says about that, however it doesn't quite match my case: I don't want to specify a job to run in the past, I want to run it in the future and ask how at will treat it if the computer is sleeping then.



      This is not a duplicate of Run at command when computer is sleeping because this question asks whether at will wake up the computer to execute the command, neither is it a duplicate of How to prevent atd from running past jobs? because this is about how to prevent at from executing those “old” jobs (with a very good answer though!).







      share|improve this question














      I want to schedule jobs with at, but I'm not sure what happens if the computer is suspended at the specified time: Will the command be executed as soon as the computer wakes up again (like with anacron) or will it not be executed at all (like with cron)?




      If you specify a job to absolutely run at a specific time and date in
      the past, the job will run as soon as possible.




      That's what the manpage says about that, however it doesn't quite match my case: I don't want to specify a job to run in the past, I want to run it in the future and ask how at will treat it if the computer is sleeping then.



      This is not a duplicate of Run at command when computer is sleeping because this question asks whether at will wake up the computer to execute the command, neither is it a duplicate of How to prevent atd from running past jobs? because this is about how to prevent at from executing those “old” jobs (with a very good answer though!).









      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 15 '17 at 13:05

























      asked Dec 15 '17 at 11:00









      dessert

      1,013321




      1,013321




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          19
          down vote













          at executes any command that should have been executed before when you wake up the computer, but may take a few minutes to do that. It doesn't even matter whether you gave it a specific date, as you can test easily:



          $ sudo date -s "2017-12-15 23:57:00"
          $ at 23:59 17-12-15 <<<'echo executed >at_test'
          job 1 at Fri Dec 15 23:59:00 2017
          # suspend, wake after four minutes
          $ date
          Sat Dec 16 00:01:17 CET 2017
          $ cat <at_test || atq
          bash: /home/dessert/at_test: No such file or directory
          1 Fri Dec 15 23:59:00 2017 a dessert
          # wait a few minutes
          $ cat <at_test || atq
          executed


          So a job you add using at 20:00 today can very well be executed suddenly three days later when you power on your computer again. If you want to prevent this you can check for the time in the job itself like proposed here: How to prevent atd from running past jobs?






          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%2f411022%2fdoes-at-run-a-command-later-if-the-computer-is-off-at-the-specified-time%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
            19
            down vote













            at executes any command that should have been executed before when you wake up the computer, but may take a few minutes to do that. It doesn't even matter whether you gave it a specific date, as you can test easily:



            $ sudo date -s "2017-12-15 23:57:00"
            $ at 23:59 17-12-15 <<<'echo executed >at_test'
            job 1 at Fri Dec 15 23:59:00 2017
            # suspend, wake after four minutes
            $ date
            Sat Dec 16 00:01:17 CET 2017
            $ cat <at_test || atq
            bash: /home/dessert/at_test: No such file or directory
            1 Fri Dec 15 23:59:00 2017 a dessert
            # wait a few minutes
            $ cat <at_test || atq
            executed


            So a job you add using at 20:00 today can very well be executed suddenly three days later when you power on your computer again. If you want to prevent this you can check for the time in the job itself like proposed here: How to prevent atd from running past jobs?






            share|improve this answer


























              up vote
              19
              down vote













              at executes any command that should have been executed before when you wake up the computer, but may take a few minutes to do that. It doesn't even matter whether you gave it a specific date, as you can test easily:



              $ sudo date -s "2017-12-15 23:57:00"
              $ at 23:59 17-12-15 <<<'echo executed >at_test'
              job 1 at Fri Dec 15 23:59:00 2017
              # suspend, wake after four minutes
              $ date
              Sat Dec 16 00:01:17 CET 2017
              $ cat <at_test || atq
              bash: /home/dessert/at_test: No such file or directory
              1 Fri Dec 15 23:59:00 2017 a dessert
              # wait a few minutes
              $ cat <at_test || atq
              executed


              So a job you add using at 20:00 today can very well be executed suddenly three days later when you power on your computer again. If you want to prevent this you can check for the time in the job itself like proposed here: How to prevent atd from running past jobs?






              share|improve this answer
























                up vote
                19
                down vote










                up vote
                19
                down vote









                at executes any command that should have been executed before when you wake up the computer, but may take a few minutes to do that. It doesn't even matter whether you gave it a specific date, as you can test easily:



                $ sudo date -s "2017-12-15 23:57:00"
                $ at 23:59 17-12-15 <<<'echo executed >at_test'
                job 1 at Fri Dec 15 23:59:00 2017
                # suspend, wake after four minutes
                $ date
                Sat Dec 16 00:01:17 CET 2017
                $ cat <at_test || atq
                bash: /home/dessert/at_test: No such file or directory
                1 Fri Dec 15 23:59:00 2017 a dessert
                # wait a few minutes
                $ cat <at_test || atq
                executed


                So a job you add using at 20:00 today can very well be executed suddenly three days later when you power on your computer again. If you want to prevent this you can check for the time in the job itself like proposed here: How to prevent atd from running past jobs?






                share|improve this answer














                at executes any command that should have been executed before when you wake up the computer, but may take a few minutes to do that. It doesn't even matter whether you gave it a specific date, as you can test easily:



                $ sudo date -s "2017-12-15 23:57:00"
                $ at 23:59 17-12-15 <<<'echo executed >at_test'
                job 1 at Fri Dec 15 23:59:00 2017
                # suspend, wake after four minutes
                $ date
                Sat Dec 16 00:01:17 CET 2017
                $ cat <at_test || atq
                bash: /home/dessert/at_test: No such file or directory
                1 Fri Dec 15 23:59:00 2017 a dessert
                # wait a few minutes
                $ cat <at_test || atq
                executed


                So a job you add using at 20:00 today can very well be executed suddenly three days later when you power on your computer again. If you want to prevent this you can check for the time in the job itself like proposed here: How to prevent atd from running past jobs?







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Dec 15 '17 at 13:04

























                answered Dec 15 '17 at 11:00









                dessert

                1,013321




                1,013321






















                     

                    draft saved


                    draft discarded


























                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f411022%2fdoes-at-run-a-command-later-if-the-computer-is-off-at-the-specified-time%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