specify a time interval in which to execute a certain scriptRun commands at a specified timeHow to send a mail for every 10 minutes through shell script?Hardware and software inventoryingbash using grep and sedHow to execute recurring Bash script at specific times?Execute command after inotifywait established watchesRun certain script periodically at boot timeBoot computer on schedule 2 times per weekdayStart playing a video at a certain timeDisable Cron for specific interval of timeAutomatically save the text-only of every web page visited?Execute script at crontab
What does it mean for a program to be 32 or 64 bit?
Managing heat dissipation in a magic wand
Does a windmilling propeller create more drag than a stopped propeller in an engine out scenario?
What to call a small, open stone or cement reservoir that supplies fresh water from a spring or other natural source?
Why was Harry at the Weasleys' at the beginning of Goblet of Fire but at the Dursleys' after?
Filter a file list against an integer array?
Connecting circles clockwise in TikZ
Keeping the dodos out of the field
Are there historical examples of audiences drawn to a work that was "so bad it's good"?
What city and town structures are important in a low fantasy medieval world?
Will this series of events work to drown the Tarrasque?
How could Dwarves prevent sand from filling up their settlements
Was Tyrion always a poor strategist?
Is there any mention of ghosts who live outside the Hogwarts castle?
Why is there no current between two capacitors connected in series?
How should I mix small caps with digits or symbols?
Is there a realtime, uncut video of Saturn V ignition through tower clear?
How can sister protect herself from impulse purchases with a credit card?
Can dirty bird feeders make birds sick?
Good examples of "two is easy, three is hard" in computational sciences
Is it wise to pay off mortgage with 401k?
What Species of Trees are These?
Story about encounter with hostile aliens
What quantum phenomena violate the superposition principle in electromagnetism?
specify a time interval in which to execute a certain script
Run commands at a specified timeHow to send a mail for every 10 minutes through shell script?Hardware and software inventoryingbash using grep and sedHow to execute recurring Bash script at specific times?Execute command after inotifywait established watchesRun certain script periodically at boot timeBoot computer on schedule 2 times per weekdayStart playing a video at a certain timeDisable Cron for specific interval of timeAutomatically save the text-only of every web page visited?Execute script at crontab
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have this bash script:
while [[ 1 ]] ; do sleep 3600 ; ./notify.sh --text "ricordati di bere" && play /mnt/musica/login.wav && zenity --info --text="<span size="xx-large">Time is $(date +%Hh%M).</span>nnricordati di <b>bere</b>." --title="drink time" ; done
I'd like to execute this script (from 8:00 o'clock, less important) to 19:00 (most important); it's possible?
I have seen at
command, but I didn't find how set "until" or "before".
This question is different from this
bash cron at
add a comment |
I have this bash script:
while [[ 1 ]] ; do sleep 3600 ; ./notify.sh --text "ricordati di bere" && play /mnt/musica/login.wav && zenity --info --text="<span size="xx-large">Time is $(date +%Hh%M).</span>nnricordati di <b>bere</b>." --title="drink time" ; done
I'd like to execute this script (from 8:00 o'clock, less important) to 19:00 (most important); it's possible?
I have seen at
command, but I didn't find how set "until" or "before".
This question is different from this
bash cron at
Monday through Friday or 7 days a week? What if the script fired regularly but only notified between those hours?
– Jeff Schaller♦
May 7 at 16:28
add a comment |
I have this bash script:
while [[ 1 ]] ; do sleep 3600 ; ./notify.sh --text "ricordati di bere" && play /mnt/musica/login.wav && zenity --info --text="<span size="xx-large">Time is $(date +%Hh%M).</span>nnricordati di <b>bere</b>." --title="drink time" ; done
I'd like to execute this script (from 8:00 o'clock, less important) to 19:00 (most important); it's possible?
I have seen at
command, but I didn't find how set "until" or "before".
This question is different from this
bash cron at
I have this bash script:
while [[ 1 ]] ; do sleep 3600 ; ./notify.sh --text "ricordati di bere" && play /mnt/musica/login.wav && zenity --info --text="<span size="xx-large">Time is $(date +%Hh%M).</span>nnricordati di <b>bere</b>." --title="drink time" ; done
I'd like to execute this script (from 8:00 o'clock, less important) to 19:00 (most important); it's possible?
I have seen at
command, but I didn't find how set "until" or "before".
This question is different from this
bash cron at
bash cron at
edited May 7 at 16:49
αғsнιη
18.1k113271
18.1k113271
asked May 7 at 16:23
DunsDuns
416
416
Monday through Friday or 7 days a week? What if the script fired regularly but only notified between those hours?
– Jeff Schaller♦
May 7 at 16:28
add a comment |
Monday through Friday or 7 days a week? What if the script fired regularly but only notified between those hours?
– Jeff Schaller♦
May 7 at 16:28
Monday through Friday or 7 days a week? What if the script fired regularly but only notified between those hours?
– Jeff Schaller♦
May 7 at 16:28
Monday through Friday or 7 days a week? What if the script fired regularly but only notified between those hours?
– Jeff Schaller♦
May 7 at 16:28
add a comment |
2 Answers
2
active
oldest
votes
You would do the scheduling with cron. The schedule would look like
0 8-19 * * * /path/to/script
or
0 8,9,10,11,12,13,14,15,16,17,18,19 * * * /path/to/script
and the script would look like
#!/bin/sh
./notify.sh --text "ricordati di bere" &&
play /mnt/musica/login.wav &&
zenity --info
--text="<span size="xx-large">Time is $(date +%Hh%M)</span>nnricordati di <b>bere</b>."
--title="drink time"
See also "How to send a mail for every 10 minutes through shell script?"
@Duns If you added the cron job as root, then it's added to root's crontab. You would view root's crontab withsudo crontab -l
. However, I just realised that you are trying to use GUI applications, so using cron for this may not be the easiest solution. Cron jobs have no connection to the display and can't generally open dialog boxes or windows.
– Kusalananda♦
May 7 at 19:38
thanks. It seems work, somehow (maybe not perfectly; btw I dont' use a GUI): at 8:00 I received on my smartphone the notify, when I was not at home; but coming back to home I didn't see the pop-up. So I tried double-click on the script and it works perfectly. I will see at 9:00. Another thing: if I would do from 8:30 to 11:30 and from 15:30 to 18:30, it should possible with cron?
– Duns
May 8 at 6:40
@Duns Seeman 5 crontab
.30 8-11,15-18 * * * /path/to/script
– Kusalananda♦
May 8 at 6:57
Thank you very much. It works, but only the sound and the smartphone notify, not the PC pop-up. I started a new session. I will see.
– Duns
May 8 at 7:13
1
It works: I added "--display=:0.0" to zenity command in bash script (as said here). Not what you said, even you gave me a great help. Thank you very much
– Duns
May 8 at 8:34
|
show 1 more comment
Presuming you use Linux, timeout is the simplest way to do this. 08:00 to 19:00 is 11 hours, so we tell timeout to run the script for 11 hours.
timeout 11h /home/username/script
Start the job with cron at 08:00 (or manually whenever you wish) and have it killed automatically at 19:00 sharp with another cron entry
kill -9 /home/username/script
Thanks, but I start the Pc non always at the same time, so your solution is not what I search for.
– Duns
May 7 at 18:40
See rephrasing above which shows greater flexibility.
– K7AAY
May 7 at 18:41
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f517611%2fspecify-a-time-interval-in-which-to-execute-a-certain-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
You would do the scheduling with cron. The schedule would look like
0 8-19 * * * /path/to/script
or
0 8,9,10,11,12,13,14,15,16,17,18,19 * * * /path/to/script
and the script would look like
#!/bin/sh
./notify.sh --text "ricordati di bere" &&
play /mnt/musica/login.wav &&
zenity --info
--text="<span size="xx-large">Time is $(date +%Hh%M)</span>nnricordati di <b>bere</b>."
--title="drink time"
See also "How to send a mail for every 10 minutes through shell script?"
@Duns If you added the cron job as root, then it's added to root's crontab. You would view root's crontab withsudo crontab -l
. However, I just realised that you are trying to use GUI applications, so using cron for this may not be the easiest solution. Cron jobs have no connection to the display and can't generally open dialog boxes or windows.
– Kusalananda♦
May 7 at 19:38
thanks. It seems work, somehow (maybe not perfectly; btw I dont' use a GUI): at 8:00 I received on my smartphone the notify, when I was not at home; but coming back to home I didn't see the pop-up. So I tried double-click on the script and it works perfectly. I will see at 9:00. Another thing: if I would do from 8:30 to 11:30 and from 15:30 to 18:30, it should possible with cron?
– Duns
May 8 at 6:40
@Duns Seeman 5 crontab
.30 8-11,15-18 * * * /path/to/script
– Kusalananda♦
May 8 at 6:57
Thank you very much. It works, but only the sound and the smartphone notify, not the PC pop-up. I started a new session. I will see.
– Duns
May 8 at 7:13
1
It works: I added "--display=:0.0" to zenity command in bash script (as said here). Not what you said, even you gave me a great help. Thank you very much
– Duns
May 8 at 8:34
|
show 1 more comment
You would do the scheduling with cron. The schedule would look like
0 8-19 * * * /path/to/script
or
0 8,9,10,11,12,13,14,15,16,17,18,19 * * * /path/to/script
and the script would look like
#!/bin/sh
./notify.sh --text "ricordati di bere" &&
play /mnt/musica/login.wav &&
zenity --info
--text="<span size="xx-large">Time is $(date +%Hh%M)</span>nnricordati di <b>bere</b>."
--title="drink time"
See also "How to send a mail for every 10 minutes through shell script?"
@Duns If you added the cron job as root, then it's added to root's crontab. You would view root's crontab withsudo crontab -l
. However, I just realised that you are trying to use GUI applications, so using cron for this may not be the easiest solution. Cron jobs have no connection to the display and can't generally open dialog boxes or windows.
– Kusalananda♦
May 7 at 19:38
thanks. It seems work, somehow (maybe not perfectly; btw I dont' use a GUI): at 8:00 I received on my smartphone the notify, when I was not at home; but coming back to home I didn't see the pop-up. So I tried double-click on the script and it works perfectly. I will see at 9:00. Another thing: if I would do from 8:30 to 11:30 and from 15:30 to 18:30, it should possible with cron?
– Duns
May 8 at 6:40
@Duns Seeman 5 crontab
.30 8-11,15-18 * * * /path/to/script
– Kusalananda♦
May 8 at 6:57
Thank you very much. It works, but only the sound and the smartphone notify, not the PC pop-up. I started a new session. I will see.
– Duns
May 8 at 7:13
1
It works: I added "--display=:0.0" to zenity command in bash script (as said here). Not what you said, even you gave me a great help. Thank you very much
– Duns
May 8 at 8:34
|
show 1 more comment
You would do the scheduling with cron. The schedule would look like
0 8-19 * * * /path/to/script
or
0 8,9,10,11,12,13,14,15,16,17,18,19 * * * /path/to/script
and the script would look like
#!/bin/sh
./notify.sh --text "ricordati di bere" &&
play /mnt/musica/login.wav &&
zenity --info
--text="<span size="xx-large">Time is $(date +%Hh%M)</span>nnricordati di <b>bere</b>."
--title="drink time"
See also "How to send a mail for every 10 minutes through shell script?"
You would do the scheduling with cron. The schedule would look like
0 8-19 * * * /path/to/script
or
0 8,9,10,11,12,13,14,15,16,17,18,19 * * * /path/to/script
and the script would look like
#!/bin/sh
./notify.sh --text "ricordati di bere" &&
play /mnt/musica/login.wav &&
zenity --info
--text="<span size="xx-large">Time is $(date +%Hh%M)</span>nnricordati di <b>bere</b>."
--title="drink time"
See also "How to send a mail for every 10 minutes through shell script?"
answered May 7 at 16:31
Kusalananda♦Kusalananda
146k18278460
146k18278460
@Duns If you added the cron job as root, then it's added to root's crontab. You would view root's crontab withsudo crontab -l
. However, I just realised that you are trying to use GUI applications, so using cron for this may not be the easiest solution. Cron jobs have no connection to the display and can't generally open dialog boxes or windows.
– Kusalananda♦
May 7 at 19:38
thanks. It seems work, somehow (maybe not perfectly; btw I dont' use a GUI): at 8:00 I received on my smartphone the notify, when I was not at home; but coming back to home I didn't see the pop-up. So I tried double-click on the script and it works perfectly. I will see at 9:00. Another thing: if I would do from 8:30 to 11:30 and from 15:30 to 18:30, it should possible with cron?
– Duns
May 8 at 6:40
@Duns Seeman 5 crontab
.30 8-11,15-18 * * * /path/to/script
– Kusalananda♦
May 8 at 6:57
Thank you very much. It works, but only the sound and the smartphone notify, not the PC pop-up. I started a new session. I will see.
– Duns
May 8 at 7:13
1
It works: I added "--display=:0.0" to zenity command in bash script (as said here). Not what you said, even you gave me a great help. Thank you very much
– Duns
May 8 at 8:34
|
show 1 more comment
@Duns If you added the cron job as root, then it's added to root's crontab. You would view root's crontab withsudo crontab -l
. However, I just realised that you are trying to use GUI applications, so using cron for this may not be the easiest solution. Cron jobs have no connection to the display and can't generally open dialog boxes or windows.
– Kusalananda♦
May 7 at 19:38
thanks. It seems work, somehow (maybe not perfectly; btw I dont' use a GUI): at 8:00 I received on my smartphone the notify, when I was not at home; but coming back to home I didn't see the pop-up. So I tried double-click on the script and it works perfectly. I will see at 9:00. Another thing: if I would do from 8:30 to 11:30 and from 15:30 to 18:30, it should possible with cron?
– Duns
May 8 at 6:40
@Duns Seeman 5 crontab
.30 8-11,15-18 * * * /path/to/script
– Kusalananda♦
May 8 at 6:57
Thank you very much. It works, but only the sound and the smartphone notify, not the PC pop-up. I started a new session. I will see.
– Duns
May 8 at 7:13
1
It works: I added "--display=:0.0" to zenity command in bash script (as said here). Not what you said, even you gave me a great help. Thank you very much
– Duns
May 8 at 8:34
@Duns If you added the cron job as root, then it's added to root's crontab. You would view root's crontab with
sudo crontab -l
. However, I just realised that you are trying to use GUI applications, so using cron for this may not be the easiest solution. Cron jobs have no connection to the display and can't generally open dialog boxes or windows.– Kusalananda♦
May 7 at 19:38
@Duns If you added the cron job as root, then it's added to root's crontab. You would view root's crontab with
sudo crontab -l
. However, I just realised that you are trying to use GUI applications, so using cron for this may not be the easiest solution. Cron jobs have no connection to the display and can't generally open dialog boxes or windows.– Kusalananda♦
May 7 at 19:38
thanks. It seems work, somehow (maybe not perfectly; btw I dont' use a GUI): at 8:00 I received on my smartphone the notify, when I was not at home; but coming back to home I didn't see the pop-up. So I tried double-click on the script and it works perfectly. I will see at 9:00. Another thing: if I would do from 8:30 to 11:30 and from 15:30 to 18:30, it should possible with cron?
– Duns
May 8 at 6:40
thanks. It seems work, somehow (maybe not perfectly; btw I dont' use a GUI): at 8:00 I received on my smartphone the notify, when I was not at home; but coming back to home I didn't see the pop-up. So I tried double-click on the script and it works perfectly. I will see at 9:00. Another thing: if I would do from 8:30 to 11:30 and from 15:30 to 18:30, it should possible with cron?
– Duns
May 8 at 6:40
@Duns See
man 5 crontab
. 30 8-11,15-18 * * * /path/to/script
– Kusalananda♦
May 8 at 6:57
@Duns See
man 5 crontab
. 30 8-11,15-18 * * * /path/to/script
– Kusalananda♦
May 8 at 6:57
Thank you very much. It works, but only the sound and the smartphone notify, not the PC pop-up. I started a new session. I will see.
– Duns
May 8 at 7:13
Thank you very much. It works, but only the sound and the smartphone notify, not the PC pop-up. I started a new session. I will see.
– Duns
May 8 at 7:13
1
1
It works: I added "--display=:0.0" to zenity command in bash script (as said here). Not what you said, even you gave me a great help. Thank you very much
– Duns
May 8 at 8:34
It works: I added "--display=:0.0" to zenity command in bash script (as said here). Not what you said, even you gave me a great help. Thank you very much
– Duns
May 8 at 8:34
|
show 1 more comment
Presuming you use Linux, timeout is the simplest way to do this. 08:00 to 19:00 is 11 hours, so we tell timeout to run the script for 11 hours.
timeout 11h /home/username/script
Start the job with cron at 08:00 (or manually whenever you wish) and have it killed automatically at 19:00 sharp with another cron entry
kill -9 /home/username/script
Thanks, but I start the Pc non always at the same time, so your solution is not what I search for.
– Duns
May 7 at 18:40
See rephrasing above which shows greater flexibility.
– K7AAY
May 7 at 18:41
add a comment |
Presuming you use Linux, timeout is the simplest way to do this. 08:00 to 19:00 is 11 hours, so we tell timeout to run the script for 11 hours.
timeout 11h /home/username/script
Start the job with cron at 08:00 (or manually whenever you wish) and have it killed automatically at 19:00 sharp with another cron entry
kill -9 /home/username/script
Thanks, but I start the Pc non always at the same time, so your solution is not what I search for.
– Duns
May 7 at 18:40
See rephrasing above which shows greater flexibility.
– K7AAY
May 7 at 18:41
add a comment |
Presuming you use Linux, timeout is the simplest way to do this. 08:00 to 19:00 is 11 hours, so we tell timeout to run the script for 11 hours.
timeout 11h /home/username/script
Start the job with cron at 08:00 (or manually whenever you wish) and have it killed automatically at 19:00 sharp with another cron entry
kill -9 /home/username/script
Presuming you use Linux, timeout is the simplest way to do this. 08:00 to 19:00 is 11 hours, so we tell timeout to run the script for 11 hours.
timeout 11h /home/username/script
Start the job with cron at 08:00 (or manually whenever you wish) and have it killed automatically at 19:00 sharp with another cron entry
kill -9 /home/username/script
edited May 7 at 18:41
answered May 7 at 16:37
K7AAYK7AAY
1,2801028
1,2801028
Thanks, but I start the Pc non always at the same time, so your solution is not what I search for.
– Duns
May 7 at 18:40
See rephrasing above which shows greater flexibility.
– K7AAY
May 7 at 18:41
add a comment |
Thanks, but I start the Pc non always at the same time, so your solution is not what I search for.
– Duns
May 7 at 18:40
See rephrasing above which shows greater flexibility.
– K7AAY
May 7 at 18:41
Thanks, but I start the Pc non always at the same time, so your solution is not what I search for.
– Duns
May 7 at 18:40
Thanks, but I start the Pc non always at the same time, so your solution is not what I search for.
– Duns
May 7 at 18:40
See rephrasing above which shows greater flexibility.
– K7AAY
May 7 at 18:41
See rephrasing above which shows greater flexibility.
– K7AAY
May 7 at 18:41
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f517611%2fspecify-a-time-interval-in-which-to-execute-a-certain-script%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
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
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
Monday through Friday or 7 days a week? What if the script fired regularly but only notified between those hours?
– Jeff Schaller♦
May 7 at 16:28