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;








3















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










share|improve this question
























  • 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

















3















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










share|improve this question
























  • 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













3












3








3








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










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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

















  • 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










2 Answers
2






active

oldest

votes


















3














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?"






share|improve this answer























  • @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











  • @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






  • 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



















1














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





share|improve this answer

























  • 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











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
);



);













draft saved

draft discarded


















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









3














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?"






share|improve this answer























  • @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











  • @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






  • 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
















3














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?"






share|improve this answer























  • @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











  • @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






  • 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














3












3








3







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?"






share|improve this answer













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?"







share|improve this answer












share|improve this answer



share|improve this answer










answered May 7 at 16:31









KusalanandaKusalananda

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 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











  • @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






  • 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











  • 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











  • 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














1














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





share|improve this answer

























  • 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















1














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





share|improve this answer

























  • 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













1












1








1







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





share|improve this answer















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






share|improve this answer














share|improve this answer



share|improve this answer








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

















  • 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

















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

Bruxelas-Capital Índice Historia | Composición | Situación lingüística | Clima | Cidades irmandadas | Notas | Véxase tamén | Menú de navegacióneO uso das linguas en Bruxelas e a situación do neerlandés"Rexión de Bruxelas Capital"o orixinalSitio da rexiónPáxina de Bruselas no sitio da Oficina de Promoción Turística de Valonia e BruxelasMapa Interactivo da Rexión de Bruxelas-CapitaleeWorldCat332144929079854441105155190212ID28008674080552-90000 0001 0666 3698n94104302ID540940339365017018237

What should I write in an apology letter, since I have decided not to join a company after accepting an offer letterShould I keep looking after accepting a job offer?What should I do when I've been verbally told I would get an offer letter, but still haven't gotten one after 4 weeks?Do I accept an offer from a company that I am not likely to join?New job hasn't confirmed starting date and I want to give current employer as much notice as possibleHow should I address my manager in my resignation letter?HR delayed background verification, now jobless as resignedNo email communication after accepting a formal written offer. How should I phrase the call?What should I do if after receiving a verbal offer letter I am informed that my written job offer is put on hold due to some internal issues?Should I inform the current employer that I am about to resign within 1-2 weeks since I have signed the offer letter and waiting for visa?What company will do, if I send their offer letter to another company