Koozali.org: home of the SME Server

Help! Cron hates me.

Offline JJSH

  • *
  • 18
  • +0/-0
Help! Cron hates me.
« on: March 24, 2009, 02:48:15 PM »
This is continued from this http://forums.contribs.org/index.php/topic,43577.0.html post, but I've started a new topic because this isn't about the crontab contrib any more. Hope that is ok.

I got a cron job working, then set it to run overnight and thought I was done. Now, I get this in the email;

Quote
/home/e-smith/files/ibays/system/html/systemscripts/dailyevents.sh: line 2: /home/e-smith/files/ibays/system/html/systemscripts/export.sql
: No such file or directory

However, this is plainly nonsense, because if I copy the offending line, and paste it into putty with a preceding vim, my sql script pops up as expected. I've checked the permissions of export.sql, and have chmod 755 them, and still get the same error.

Can anyone suggest what to check next? The frustrating thing is that it was working, I simply added an echo command at the end of the shell script to say that it had finished, but I've removed this so that it is as before.

Offline JJSH

  • *
  • 18
  • +0/-0
Re: Help! Cron hates me.
« Reply #1 on: March 24, 2009, 04:49:10 PM »
Interesting. I have recreated my .sh and .sql files and put them in a shorter path, /home/scripts/, and now the job fails with;

ERROR 1 (HY000) at line 1: Can't create/write to file '/home/e-smith/files/ibays/system/html/export/dailyexport.csv' (Errcode: 13)

which is the path the sql writes to now (which I've checked exists).

The thing is, the cron job runs a root. How can this be possible?

Offline janet

  • *****
  • 4,812
  • +0/-0
Re: Help! Cron hates me.
« Reply #2 on: March 24, 2009, 07:29:33 PM »
JJSH

Have you set appropriate read write & ownership permissions on those scripts.

Also it would help if you quoted the actual cron job text, so we could see what errors you are making (if any).
Please search before asking, an answer may already exist.
The Search & other links to useful information are at top of Forum.