Is it possible to run a job for 2 hours at a specific time? So lets say I want to run wget command that calls/hits an endpoint in my web app for 2 consecutive hours in a day. Meaning that every single minute I want to hit this end point for the allocated 2 hour time slot. How do I do this?
589
This is a  about using cron &amp; crontab.   You have been directed here because the community is fairly sure that the answer to your question can be found below. If your question is not answered below then the answers will help you gather information that will help the community help you. This information should be edited into your original question.  The answer for 'Why is my crontab not working, and how can I troubleshoot it?' can be seen below.  This addresses the cron system with the crontab highlighted.
33171
I'm having some periodic issues running a particular application, XBMC. If I use XBMC regularly I don't seem to have any issues but if I leave it unattended for more than about 12 hours I need to reboot to get it working again.  I know a scheduled reboot is NOT the answer but until I can figure out the problem I need to schedule a reboot each morning so my wife can use it if I'm away and it doesn't get thrown out the window :)  Any takers?
72278
How do I execute a program X times in the terminal?  I read that I have to do a bin/bash txt, but I don't know how to execute this X times.
73722
Is there a full featured, job scheduling package available for PHP? I'm looking for the PHP equivalent to Java's . I'm fine having things triggered externally from cron to drive the system. The functionality I'd be looking for:   Ability to register task (class/method) to be called at given intervals. Ability to specify whether a given task can be run multiple times (potentially long running methods should not be run multiple times in certain cases). All registered entries/methods could be run in parallel (jobs are backgrounded so that they do not block other timed tasks). Ability to set a timeout for a given task. Ability to update job control dynamically, so for instance you could disable some tasks or change their frequency without code changes.   I know it is a lot to ask, but it seems like a useful batch of features and I thought someone might have put together some portion of them.  If this or some portion of this does not already exist, any pointers to putting one together or an open source project that has a reasonably featureful implementation of some subset of these?
13012
I have a few cleanup commands to run for my datacaching scheme.  I was thinking a bash script would be an easy way to check if the full clean up job needed to be run.  But the cache is very time sensitive, so the check script needs to run every second.  What's the best way to do this?  Crontab only goes down to minutes, which makes sense for most applications.  Can I install a bash script as a background service?  On second though, can I just start it with the &amp; command and make it loop forever with a one second sleep?
77141
I want my bash script to sleep until a specific time. So, I want a command like "sleep" which takes no interval but an end time and sleeps until then.  The "at"-daemon is not a solution, as I need to block a running script until a certain date/time.  Is there such a command?
21717
I want to run a job every 3 seconds, however in SQL Server 2008 we cannot define an interval of less than 10 seconds.  The job is used to insert/update visitor information, and segmentation information into a database which is tracked by google search.   There are up to about 100 rows inserted in a 2 or 3 seconds. That job inserts and update the table in a database. Is there any way to schedule it using sp job scheduling configuration?
17822
Can anyone suggest a way of asking Windows to shut down after it has finished doing something? For example it would be handy sometimes if burning a DVD or copying a lot of files to be able to set it off at the end of the day and just say "hey Windows, when you've finished doing this, shut down."  At the moment the best alternative I've found is to use a commandline shutdown and guess at a time but particularly with things like file operations windows can make it a trifle difficult to predict how long they will take so you have to be very conservative in your guesswork and probably leave the computer running for much longer than necessary in most cases or risk the job not being finished.
30087
I have started a wget on remote machine in background using &amp;. Suddenly it stops downloading. I want to terminate its process, then re-run the command. How can I terminate it?  I haven't closed its shell window. But as you know it doesn't stop using Ctrl+C and Ctrl+Z.
93543
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  because this question asks whether at will wake up the computer to execute the command, neither is it a duplicate of  because this is about how to prevent at from executing  those “old” jobs (with a very good answer though!).
110474
Everyday, I usually start my Mac Mini at 16:00 and shutdown it at 2:00 using the Energy Saver schedule settings.  I would like to be able to set a different behavior on the Weekends starting Mac Mini at 9:00 for example. Do you know any way to achieve that (third party software, cron job, superuser trick)?
106574
I have been reading on  OnCalendar=   Sadly, I found no info on how to schedule an event on a day other way than defining a day of the week, which would make it run every week at the rarest.  I need it to run every, say, 14 days. And at a specified hour (say, 4am). Is this possible with systemd?
118630
How would you go about turning you computer after a specified amount of time?   I listen music before I go to sleep and would like to be able to shutdown my computer after a specified amount of time. After ½ an hour say.   It would be cool if you could connect a desktop shortcut to a task in scheduler so you click the shortcut and ½ an hour later it shuts down.
27200
I find that at the end of a long day, I sometimes have a large number of programs running. All which I will need to use tomorrow. Normally, this isn't an issue, I can simply lock the machine and come back tomorrow. My problem arrises when windows update launches in the middle of the night and force restarts my computer. That in turns closes all my open software. I of course save everything regularly so I don't loose anything, but I waste time reopening all of those resources whenever there is a restart.   [EDIT]  I should clarify that I still want to be able to restart my computer when an update comes down. Preventing the restart only delays the problem until later. I should have been more specific in that I want to be able to recover my working environment after a restart for any reason. Things like scheduled maintence, power loss, updates, and software installs.  [EDIT]  I can't simply have them setup to launch at startup becasuse those files change from week to week. So I need something that monitors what I have open, and gives me the option to "recover" those software sessions when I log back in.  Anyone have any suggestions on what I can do? I'd even be willing to purchase software to do this for me if that is the only option.  Thanks
12089
Today we have built a console application for running the scheduled tasks for our ASP.NET website. But I think this approach is a bit error prone and difficult to maintain. How do you execute your scheduled task (in an windows/IIS/ASP.NET environment)  Update:   Examples of tasks:   Sending email from an email-queue in the database Removing outdated objects from the database Retrieving stats from Google AdWords and fill a table in the database.
73601
I have a simple launchd script that plays a sound every 30 minutes and it runs out of the user library ~/Library . It doesn't run if my machine is asleep, but does run the last event missed when the machine wakes. I think this is the expected behavior. My question is, how do I stop this happening. If I missed the half-hour event, I don't want it to be run at 20 minutes past the hour.  Here's the core of my script. It calls a Python script. I tried to put a block in the python script to check that I am within a few minutes of each 30 minutes, but that doesn't seem to work on wake. (Is it missing the system clock somehow?)  &lt;key&gt;ProgramArguments&lt;/key&gt; &lt;array&gt;     &lt;string&gt;/usr/local/bin/python3&lt;/string&gt;     &lt;string&gt;/Users/pheon/Documents/playsound.py&lt;/string&gt; &lt;/array&gt;  &lt;key&gt;StartCalendarInterval&lt;/key&gt; &lt;array&gt;     &lt;dict&gt;         &lt;key&gt;Minute&lt;/key&gt;         &lt;integer&gt;0&lt;/integer&gt;     &lt;dict&gt;         &lt;key&gt;Minute&lt;/key&gt;         &lt;integer&gt;30&lt;/integer&gt;     &lt;/dict&gt; &lt;/array&gt;   Here is a snippet from the python code which checks the time before playing the sound.  time0 = datetime.datetime.now() if (time0.minute % 30) &lt; 2:     subprocess.run(["/Users/pheon/bin/afplay-vol.sh", "1", bell],check=True)
95549
I have this problem in my office that multiple Macs always run 24/7 and my boss said that I need to make it stop. Now I don't have much experience with Macs, I'm more the Windows type.   I have one Mac who acts as a server and would like to run a script or something like that to orchestrate the power status of several computers if that helps.  How can I shut down all of those 7-8 Macs remotely at 11:30pm?