How to startup application only on schedule?
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
2
down vote
favorite
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:
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
add a comment |Â
up vote
2
down vote
favorite
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:
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
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
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:
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
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:
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
startup
edited Apr 10 at 14:02
![](https://i.stack.imgur.com/Lrlbx.jpg?s=32&g=1)
![](https://i.stack.imgur.com/Lrlbx.jpg?s=32&g=1)
pa4080
12.2k52255
12.2k52255
asked Apr 10 at 11:51
Tymur Valiiev
112
112
add a comment |Â
add a comment |Â
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.
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 addsleep 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
add a comment |Â
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.
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 addsleep 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
add a comment |Â
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.
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 addsleep 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
add a comment |Â
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.
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.
edited Apr 10 at 14:55
answered Apr 10 at 13:38
![](https://i.stack.imgur.com/Lrlbx.jpg?s=32&g=1)
![](https://i.stack.imgur.com/Lrlbx.jpg?s=32&g=1)
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 addsleep 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
add a comment |Â
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 addsleep 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
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password