LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Cron job stopping before it finishes (https://www.linuxquestions.org/questions/linux-newbie-8/cron-job-stopping-before-it-finishes-158069/)

melk600 03-15-2004 03:00 PM

Cron job stopping before it finishes
 
I set up a simple cron job that runs the syncronization program Unison.

My problem is that it doesn't work unless it can run very quickly. If I change just one file it will run just fine, but if it has to syncronize say 20 or more files, it doesn't syncronize any of them. The only thing different between these 2 jobs that I can see being different is the time they take to run. Running the same command from the shell, the 1 file syncronization takes about 15 seconds to run, and the 20 file sync takes around 40 seconds (changes slightly depending on file size of course). So, does cron have some sort of timeout feature that is stopping it, or something else altogether different.

Any help would be much appreciated.

P.S. running Fedora Core 1 on an i386 platform

oobayly 03-25-2004 07:47 AM

Same Problem
 
I'm running Mandrake 10.0 Community on an i586 and have a similar problme. I've got a script which backs up a remote DB and tars & gzips files from local Samba shares. It can take up to 20min to run
If I run it in a shell or through webadmin (execute cron job immediately) it runs fine, but when it is executes as a scheduled job it stops after backing up the DB. I'm thinking it's a similar problem to yours.
Have you found a solution, or a way in altering the cron job's timeout

dominant 03-25-2004 08:05 AM

Is there any error message for the unfinished cron job?

oobayly 03-25-2004 08:47 AM

Nope, both the cron error & warning logs are empty, the info log just reports that the job was started.
Is there a timeout option for cron jobs?

melk600 03-25-2004 09:07 AM

I found an easy solution to both of our problems, not a fix (still can't figure out what is causing it, no errors same as you, just job started in the log). Anyhow, the way I fixed it was to download fcron. It is similar to cron only it actually has more options for scheduling times. And best of all it works.

You can get it from http://fcron.free.fr/

JZL240I-U 03-25-2004 09:22 AM

There is also anacron.

Koppie 04-22-2007 08:32 PM

I've got a similar problem. I want my wife's computer to back up to the server once a day. I've set up unison and it works fine when I do a manual run. I can use the preferences file or just do it all from the command line:
Code:

/usr/bin/unison -batch /media/sda4/ "ssh://192.168.1.3//media/hdc1/Lena Backup/"
It works either way. I've even created a small script:
Code:

#!/bin/sh
echo "Began run" >> /home/sweetie/unison.log
date >> /home/sweetie/unison.log
/usr/bin/unison -batch /media/sda4/ "ssh://192.168.1.3//media/hdc1/Lena Backup/"
echo "Ended run" >> /home/sweetie/unison.log
date >> /home/sweetie/unison.log

This way I can watch unison.log and even if unison doesn't work, it'll still give me the date & time so I know the script ran.

I've also successfully set up a cron job to run the script, and I get output in unison.log so I know the script ran.

I even added the SSH keys so it won't ask for a password.

Here's the problem: unison won't run as part of a cron job. If I run the script, it will still put the date & time in unison.log, but unison itself won't run.

I've tried everything I could think of:
- run unison with a prefs file in crontab
- run unison with a straight command line in crontab
- run my script in crontab
- tried all these things in both the user's crontab as well as /etc/crontab

Doesn't work!!! She's running Kubuntu Feisty Fawn (brand new stable version). Cron, Anacron, Unison, and SSH are all running.

What on earth is going wrong? What did I miss? How do I fix it? I saw the suggestion to run fcron, but frankly I've got two cron programs running already. I'd rather learn how to use them properly. Any ideas???

Thanks in advance!!!

JZL240I-U 04-23-2007 01:53 AM

I use fcron by now. It has very many options and is predestined for workstations which are not running round the clock. And the author suggests that fcron will replace cron in time ;)...

So you could use it while still trying to find out about cron -- I can't help you there, sorry.


All times are GMT -5. The time now is 06:22 PM.