How to startup application only on schedule?

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








up vote
2
down vote

favorite
1












I would like to start on boot Slack only when I'm at work (basically, its 10:00 am till 18:00 pm on working days). I do not really want to write custom scripts, I would like to check this in more good way, for example:



here



But how? My first approach is to use cron's @reboot with date - not looks like its possible. Secondly, I've tried to search for tool, which you pass test string in crontab format and getting error code 1 or 0 back - no luck here.



Could you please point me in right direction?










share|improve this question



























    up vote
    2
    down vote

    favorite
    1












    I would like to start on boot Slack only when I'm at work (basically, its 10:00 am till 18:00 pm on working days). I do not really want to write custom scripts, I would like to check this in more good way, for example:



    here



    But how? My first approach is to use cron's @reboot with date - not looks like its possible. Secondly, I've tried to search for tool, which you pass test string in crontab format and getting error code 1 or 0 back - no luck here.



    Could you please point me in right direction?










    share|improve this question

























      up vote
      2
      down vote

      favorite
      1









      up vote
      2
      down vote

      favorite
      1






      1





      I would like to start on boot Slack only when I'm at work (basically, its 10:00 am till 18:00 pm on working days). I do not really want to write custom scripts, I would like to check this in more good way, for example:



      here



      But how? My first approach is to use cron's @reboot with date - not looks like its possible. Secondly, I've tried to search for tool, which you pass test string in crontab format and getting error code 1 or 0 back - no luck here.



      Could you please point me in right direction?










      share|improve this question















      I would like to start on boot Slack only when I'm at work (basically, its 10:00 am till 18:00 pm on working days). I do not really want to write custom scripts, I would like to check this in more good way, for example:



      here



      But how? My first approach is to use cron's @reboot with date - not looks like its possible. Secondly, I've tried to search for tool, which you pass test string in crontab format and getting error code 1 or 0 back - no luck here.



      Could you please point me in right direction?







      startup






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Apr 10 at 14:02









      pa4080

      12.2k52255




      12.2k52255










      asked Apr 10 at 11:51









      Tymur Valiiev

      112




      112




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote













          The command date +%u will output the day of the week as number. The command date +%k will output the current hour in 24h format. We can use command substitution $() and bash double brackets test [[ to create an appropriate condition:



          bash -c '[[ $(date +%u) == [1-5] && $(date +%k) == 1[0-7] ]] && /path/executable'



          • [1-5] - is a regular expression that describes the working days of the week.

          • 1[0-7] - is a regexp that describes the working hours, it will cover from 10:00 to 17:59.


          • /path/executable is a synopsis for the command/application that you want to run.


          • Within the expression [[ <condition-1> && <condition-2> ]], the logical and && means that both conditions must be fulfilled.


          According to the question, you can use the above command within crontab, or with Startup Applications. For couple of reasons I would prefer to use Startup Applications.






          share|improve this answer






















          • i think it will work, ill find out tomorrow.
            – Tymur Valiiev
            Apr 10 at 19:33










          • @ТимурВалиев, it works in the command line. If there is an issue try to add sleep 15 && in front of the command - 15 seconds should be enough for the graphical environment to be completely loaded.
            – pa4080
            Apr 10 at 19:41










          • Its not working for me. Tried few days, no luck. It works in commandline, but not via "Startup Applications"
            – Tymur Valiiev
            Apr 16 at 17:59










          Your Answer







          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "89"
          ;
          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: true,
          noModals: false,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          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%2faskubuntu.com%2fquestions%2f1023623%2fhow-to-startup-application-only-on-schedule%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













          The command date +%u will output the day of the week as number. The command date +%k will output the current hour in 24h format. We can use command substitution $() and bash double brackets test [[ to create an appropriate condition:



          bash -c '[[ $(date +%u) == [1-5] && $(date +%k) == 1[0-7] ]] && /path/executable'



          • [1-5] - is a regular expression that describes the working days of the week.

          • 1[0-7] - is a regexp that describes the working hours, it will cover from 10:00 to 17:59.


          • /path/executable is a synopsis for the command/application that you want to run.


          • Within the expression [[ <condition-1> && <condition-2> ]], the logical and && means that both conditions must be fulfilled.


          According to the question, you can use the above command within crontab, or with Startup Applications. For couple of reasons I would prefer to use Startup Applications.






          share|improve this answer






















          • i think it will work, ill find out tomorrow.
            – Tymur Valiiev
            Apr 10 at 19:33










          • @ТимурВалиев, it works in the command line. If there is an issue try to add sleep 15 && in front of the command - 15 seconds should be enough for the graphical environment to be completely loaded.
            – pa4080
            Apr 10 at 19:41










          • Its not working for me. Tried few days, no luck. It works in commandline, but not via "Startup Applications"
            – Tymur Valiiev
            Apr 16 at 17:59














          up vote
          1
          down vote













          The command date +%u will output the day of the week as number. The command date +%k will output the current hour in 24h format. We can use command substitution $() and bash double brackets test [[ to create an appropriate condition:



          bash -c '[[ $(date +%u) == [1-5] && $(date +%k) == 1[0-7] ]] && /path/executable'



          • [1-5] - is a regular expression that describes the working days of the week.

          • 1[0-7] - is a regexp that describes the working hours, it will cover from 10:00 to 17:59.


          • /path/executable is a synopsis for the command/application that you want to run.


          • Within the expression [[ <condition-1> && <condition-2> ]], the logical and && means that both conditions must be fulfilled.


          According to the question, you can use the above command within crontab, or with Startup Applications. For couple of reasons I would prefer to use Startup Applications.






          share|improve this answer






















          • i think it will work, ill find out tomorrow.
            – Tymur Valiiev
            Apr 10 at 19:33










          • @ТимурВалиев, it works in the command line. If there is an issue try to add sleep 15 && in front of the command - 15 seconds should be enough for the graphical environment to be completely loaded.
            – pa4080
            Apr 10 at 19:41










          • Its not working for me. Tried few days, no luck. It works in commandline, but not via "Startup Applications"
            – Tymur Valiiev
            Apr 16 at 17:59












          up vote
          1
          down vote










          up vote
          1
          down vote









          The command date +%u will output the day of the week as number. The command date +%k will output the current hour in 24h format. We can use command substitution $() and bash double brackets test [[ to create an appropriate condition:



          bash -c '[[ $(date +%u) == [1-5] && $(date +%k) == 1[0-7] ]] && /path/executable'



          • [1-5] - is a regular expression that describes the working days of the week.

          • 1[0-7] - is a regexp that describes the working hours, it will cover from 10:00 to 17:59.


          • /path/executable is a synopsis for the command/application that you want to run.


          • Within the expression [[ <condition-1> && <condition-2> ]], the logical and && means that both conditions must be fulfilled.


          According to the question, you can use the above command within crontab, or with Startup Applications. For couple of reasons I would prefer to use Startup Applications.






          share|improve this answer














          The command date +%u will output the day of the week as number. The command date +%k will output the current hour in 24h format. We can use command substitution $() and bash double brackets test [[ to create an appropriate condition:



          bash -c '[[ $(date +%u) == [1-5] && $(date +%k) == 1[0-7] ]] && /path/executable'



          • [1-5] - is a regular expression that describes the working days of the week.

          • 1[0-7] - is a regexp that describes the working hours, it will cover from 10:00 to 17:59.


          • /path/executable is a synopsis for the command/application that you want to run.


          • Within the expression [[ <condition-1> && <condition-2> ]], the logical and && means that both conditions must be fulfilled.


          According to the question, you can use the above command within crontab, or with Startup Applications. For couple of reasons I would prefer to use Startup Applications.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Apr 10 at 14:55

























          answered Apr 10 at 13:38









          pa4080

          12.2k52255




          12.2k52255











          • i think it will work, ill find out tomorrow.
            – Tymur Valiiev
            Apr 10 at 19:33










          • @ТимурВалиев, it works in the command line. If there is an issue try to add sleep 15 && in front of the command - 15 seconds should be enough for the graphical environment to be completely loaded.
            – pa4080
            Apr 10 at 19:41










          • Its not working for me. Tried few days, no luck. It works in commandline, but not via "Startup Applications"
            – Tymur Valiiev
            Apr 16 at 17:59
















          • i think it will work, ill find out tomorrow.
            – Tymur Valiiev
            Apr 10 at 19:33










          • @ТимурВалиев, it works in the command line. If there is an issue try to add sleep 15 && in front of the command - 15 seconds should be enough for the graphical environment to be completely loaded.
            – pa4080
            Apr 10 at 19:41










          • Its not working for me. Tried few days, no luck. It works in commandline, but not via "Startup Applications"
            – Tymur Valiiev
            Apr 16 at 17:59















          i think it will work, ill find out tomorrow.
          – Tymur Valiiev
          Apr 10 at 19:33




          i think it will work, ill find out tomorrow.
          – Tymur Valiiev
          Apr 10 at 19:33












          @ТимурВалиев, it works in the command line. If there is an issue try to add sleep 15 && in front of the command - 15 seconds should be enough for the graphical environment to be completely loaded.
          – pa4080
          Apr 10 at 19:41




          @ТимурВалиев, it works in the command line. If there is an issue try to add sleep 15 && in front of the command - 15 seconds should be enough for the graphical environment to be completely loaded.
          – pa4080
          Apr 10 at 19:41












          Its not working for me. Tried few days, no luck. It works in commandline, but not via "Startup Applications"
          – Tymur Valiiev
          Apr 16 at 17:59




          Its not working for me. Tried few days, no luck. It works in commandline, but not via "Startup Applications"
          – Tymur Valiiev
          Apr 16 at 17:59

















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1023623%2fhow-to-startup-application-only-on-schedule%23new-answer', 'question_page');

          );

          Post as a guest













































































          Popular posts from this blog

          pylint3 and pip3 broken

          Missing snmpget and snmpwalk

          How to enroll fingerprints to Ubuntu 17.10 with VFS491