crontab - schedule job to run every minute
I am setting crontab to run a script every minute irrespective of the current hour's value:
Code:
[root@localhost bin]# ls Any solutions? Does the line mean: "Run this script every day at hour:01"? |
Yes it does, for every minute use "*" in the first position
|
Quote:
and What should be for after every 12 hour? |
Probably easier if you check out some examples : http://adminschoice.com/crontab-quick-reference
cheers |
Quote:
Before I would check my post here, I had got the solution. I asked an Admin of UNIX here and he told me that *would be used "for every minute". */5 means every 5 minutes. Code:
*/5 * * * * /root/bin/showTime.sh Code:
*/60 * * * * /root/bin/showTime.sh Code:
*/60 */12 * * * /root/bin/showTime.sh I am going to put those lines in my crontab and will check the output when I come to office tonight. My shift is over. I am going now! |
For jobs to be run every 12 hour, this crontab entry didn't execute at all:
Code:
*/60 */12 * * * /root/bin/showTime.sh Code:
* */12 * * * /root/bin/at12.sh |
If this is on your local machine and not a remote server, you could be lazy and use a GUI called Gnome Schedule to set up the task for you.
According to the GUI, you need * * * * * 's to run a task every minute. |
Quote:
Why not just run the script one time (system startup?), and put a "sleep 60" statement in it, and loop back to the beginning?? That way, even if it takes 5 minutes to execute, it'll finish ONE loop, sleep 60 seconds, then run again, instead of cranking off 5 fresh copies... |
Quote:
GUI is for kids! No matter how many key strokes a command or task may require, I would prefer the old command line interface or console. Well, I am using PUTTY to login remotely on the server. |
Quote:
Well, in production servers we cannot reboot servers like that. Besides, running a job every minute is not what we (or at least I) would do. It is just a problem! Anyways, I have done it. Code:
*/59 * * * * /root/bin/at60.sh Code:
*/60 * * * * /root/bin/at60.sh |
Quote:
Quote:
Quote:
|
Quote:
We all have to start somewhere and if Linux was not so fiddly and picky, it may have a chance at kicking windows off the top slot... but it isn't. As for the comment, it was only a suggestion to solve a problem quickly, sometimes the method or means of performing a task are less important than the actual outcome. |
Quote:
I respect your age and experience, sir. Please, don't mind my comment. I am sometimes a kind of "showing-humour". Well, I agree to what you have said: Quote:
|
Quote:
|
Quote:
|
All times are GMT -5. The time now is 02:44 PM. |