cron

How do I increase timeout for a cronjob/crontab?

I have written a script that gets data from solr for which date is within the specified period, and I run the script using as a daily cron. The problem is the cronjob does not complete the task. If I manually run the script (for the same time period), it works well. If I reduce the specified time period, the script runs from the cron as...

Request a webpage with Cron

I have an MVC architecture and since I already have an action that would be extra useful if automatically called every hour or so, I wondered if there's a way to set it up as a cron job? ...

Secure MySQL backup cron job – my.cnf is not being read

I have tried to make backup cron job on my webserver running FreeBSD. Currently it looks something like this: /usr/local/bin/mysqldump --opt --single-transaction --comments --dump-date --no-autocommit --all-databases --result-file=/var/backups/mysql/all.sql It works fine when I run it as root (since root has a .my.cnf with the use...

How to debug an issue of cron's not executing a given script -- or other?

I have a Rails script that I would like to run daily. I know there are many approaches, and that a cron'd script/runner approach is frowned upon by some, but it seems to meet my needs. However, my script is not getting executed as scheduled. My application lives at /data/myapp/current, and the script is in script/myscript.rb. I can r...

How can I programmatically create a new cron job?

I want to be able to programatically add a new cron job, what is the best way to do this? From my research, it seems I could dump the current crontab and then append a new one, piping that back into crontab: (crontab -l ; echo "0 * * * * wget -O - -q http://www.example.com/cron.php") | crontab - Is there a better way? ...

Java library class to handle scheduled execution of "callbacks"?

My program has a component - dubbed the Scheduler - that lets other components register points in time at which they want to be called back. This should work much like the Unix cron service, i. e. you tell the Scheduler "notify me at ten minutes past every full hour". I realize there are no real callbacks in Java. Here's my approach, i...

Run a script on Windows startup without a user logged on

This is a Windows 2003 machine that gets switched on every morning, but no one logs on until some hours later. I want to use the time in between to run a backup script c:\script\backup.cmd How can I start this unattended after the machine has come up? I tried 2 registry keys, but this resulted in the script being run after a user logs...

What is the XDG_SESSION_COOKIE environment variable for?

Hi all. I've been fighting with crontab recently because in Intrepid the gconftool uses a dbus backend, and that means that when used from crontab it doesn't work. To make it work I have had to export the relevant environment variables when I log in so that it finds the dbus session address when the cron comes to run. Out of curiosity...

Cron-like system for Windows?

I'm looking for an equivalent to a Cron system for Windows. The idea is to able to schedule a trigger and monitor whether it has run successfully or not. What the system need to do is the following: It should be able to trigger Win32 COM objects and/or executables. It should be able to trigger .NET COM objects and/or .NET executables....

I want to make a conditional cronjob

I have a cron job that runs every hour. It accesses an xml feed. If the xml feed is unvailable (which seems to happen once a day or so) it creates a "failure" file. This "failure" file has some metadata in it and is erased at the next hour when the script runs again and the XML feed works again. What I want is to make a 2nd cron job ...

Best rails solution for a mailer that runs every minute

Hello, I have an application that checks a database every minute for any emails that are supposed to be sent out at that time. I was thinking about making this a rake task that would be run by a cron job every minute. Would there be a better solution to this? From what I have read, this isn't ideal because rake has to load the entire ra...

How to run a php script in cron

I have found many questions and articles about this but i still have some difficulties. I'm using the following command /usr/bin/php home/domain.com/public_html/cron/script.php I receive the following error Status: 404 Not Found X-Powered-By: PHP/5.2.8 Content-type: text/html No input file specified. i'm using Cpanel, the file is host...

How do I write a bash script to restart a process if it dies?

I have a python script that'll be checking a queue and performing an action on each item: # checkqueue.py while True: check_queue() do_something() How do I write a bash script that will check if it's running, and if not, start it. Roughly the following pseudo code (or maybe it should do something like ps | grep?): # keepalivescr...

Does cron expression in unix/linux allow specifying exact start and end dates

I want to be able to configure something like this. I want to run job 'X' at 7 AM everyday starting from 29/june/2009 till 30/12/2009. Consider current date as 4/4/2009. ...

How do you run a crontab in Cygwin on Windows?

Some cygwin commands are .exe, so you can run them with the standard Windows Scheduler, but others are not .exe extension so cant be run from dos (it seems like). For example I want updatedb to run nightly. Any ideas on how to make cron work? ...

Simple Spring, use of ClasspathApplicationContext for standalone apps, how to reuse?

If I have a standalone main application. Say 20 classes. They all may need to interface with the beans defined by the spring configuration (ApplicationContext) at any time. I would boostrap the classpath application context at the main application entry point. But how do you reuse the already instantiated beans? For example, it seem...

Going nuts with executing pyton script via crontab on debian!

This is what my crontab file looks like: * * * * * root /usr/bin/python /root/test.py >> /root/classwatch.log 2>&1 This is what my python script looks like: #!/usr/bin/python print "hello" The cronjob creates the log file. But it is empty. I am also pretty certain that the python file is not being executed. Appreciate any help! I...

Is there a way to schedule a cron job that does not run on the 3rd weekend of the month?

Any ideas, anyone? ...

How can I make my PHP-based cron job execute more often?

I have a file "update.php" which does some MySQL operations. A cron job executes this file every 5 minutes. Unfortunately, I cannot execute the cron job more often. So I had the idea that I could add ... <html> <head> <meta http-equiv="refresh" content="2; URL=<?php echo $_SERVER['SCRIPT_NAME']; ?>" /> </head> <body></body> </html> ...

How to do a cron job every 72 minutes

How would I get a cron job to run every 72 minutes? Or some not so pretty number like that? ...