Page 2 of 2
Posted: Thu May 17, 2007 11:35 am
by Jenk
ah, ok. I was assuming it was the other way around; in that the cron-job worked, but the webserver did not.
Ok; there are other things to consider for this. Is the server a 3rd party hosted server? (Such as a godaddy server?)
Posted: Thu May 17, 2007 11:56 am
by kbrown3074
Nope..its a server on site. I can access anything on the server, just not sure what to modify.
Posted: Thu May 17, 2007 2:24 pm
by Jenk
ok, try creating the file..
Code: Select all
touch /var/www/htdocs/daily_edts/sheets/2007_05_14_treeleads.txt
Posted: Fri May 18, 2007 6:36 am
by kbrown3074
That allows me to create the file with no problems. Not sure why this is giving so much trouble.
Posted: Fri May 18, 2007 6:56 am
by Jenk
Neither am I..
Right, let's check the user/group of cron itself to make sure it's not being blocked.
Post both of the outputs from these:
Code: Select all
ls -l `which cron`
ls -l /var/www/htdocs/daily_edts
Posted: Tue May 22, 2007 9:58 am
by kbrown3074
This is the directory that allows me to create the sheets from the cron
Code: Select all
root@seq2:/var/www/htdocs/daily_reports/sheets# ls -l `which cron`
-rwxr-xr-x 1 root root 30764 2006-07-20 22:14 /usr/sbin/cron
root@seq2:/var/www/htdocs/daily_reports/sheets# ls -la
total 20
drwxrwxrwx 2 root root 4096 2007-05-22 09:15 .
drwxrwxrwx 4 root root 4096 2007-05-22 10:33 ..
-rw-r--r-- 1 root root 10240 2007-05-22 09:15 gwoeib2007-05-22.xls
root@seq2:/var/www/htdocs/daily_reports/sheets#
This is the directory that is giving me problems
Code: Select all
root@seq2:/var/www/htdocs/daily_edts# ls -l `which cron`
-rwxr-xr-x 1 root root 30764 2006-07-20 22:14 /usr/sbin/cron
root@seq2:/var/www/htdocs/daily_edts#
root@seq2:/var/www/htdocs/daily_edts# ls -la
total 88
drwxrwxrwx 3 root root 4096 2007-05-18 07:49 .
drwxr-xr-x 9 root root 4096 2007-05-10 11:01 ..
-rw-r--r-- 1 root root 1704 2007-05-10 12:09 cont66outall.php
-rw-r--r-- 1 root root 2643 2007-05-17 09:40 dtreeedt.php
-rw-r--r-- 1 root root 1389 2007-05-11 14:21 dtreeleads.php
-rw-r--r-- 1 root root 1539 2007-05-11 14:21 edtcreate.php
-rw-r--r-- 1 root root 712 2007-05-17 13:51 edts.php
-rw-r--r-- 1 root root 1012 2007-05-17 12:14 edttest.php
-rw-r--r-- 1 root root 856 2007-05-10 13:44 functlib.php
-rw-r--r-- 1 root root 2367 2007-05-10 13:44 ibcibedt.php
-rw-r--r-- 1 root root 1326 2007-05-10 13:54 kitxls.php
-rw-r--r-- 1 root root 1482 2007-05-11 13:42 medall.php
-rw-r--r-- 1 root root 1158 2007-05-11 13:42 multiedt.php
-rw-r--r-- 1 root root 19349 2007-05-10 13:11 mysqlclass.php
-rw-r--r-- 1 root root 1240 2007-05-10 14:00 outfin.php
-rw-r--r-- 1 root root 991 2007-05-10 13:57 outnew.php
-rw-r--r-- 1 root root 998 2007-05-10 13:59 outunf.php
drwxrwxrwx 2 mysql mysql 4096 2007-05-18 07:01 sheets
root@seq2:/var/www/htdocs/daily_edts#
Posted: Tue May 22, 2007 10:16 am
by Jenk
Check that cron has read access to the parent directories (i.e. '/var', '/var/www', '/var/www/htdocs', and '/var/www/htdocs/daily_reports')
Posted: Tue May 22, 2007 10:36 am
by kbrown3074
Like this?
Code: Select all
root@seq2:~# ls -l `which cron` /var
-rwxr-xr-x 1 root root 30764 2006-07-20 22:14 /usr/sbin/cron
/var:
total 40
drwxr-xr-x 2 root root 4096 2007-03-09 06:25 backups
drwxr-xr-x 8 root root 4096 2007-01-02 07:48 cache
drwxr-xr-x 21 root root 4096 2007-01-31 11:26 lib
drwxrwsr-x 2 root staff 4096 2006-10-19 18:49 local
drwxrwxrwt 3 root root 60 2007-04-24 07:33 lock
drwxr-xr-x 8 root root 4096 2007-05-22 06:25 log
drwxrwsr-x 2 root mail 4096 2007-01-02 07:43 mail
drwxr-xr-x 2 root root 4096 2007-01-02 07:43 opt
drwxr-xr-x 8 root root 320 2007-05-22 06:25 run
drwxr-xr-x 3 root root 4096 2007-01-02 07:48 spool
drwxrwxrwt 2 root root 4096 2007-05-14 08:19 tmp
drwxr-xr-x 4 root root 4096 2007-01-02 13:04 www
root@seq2:~# ls -l `which cron` /var/www
-rwxr-xr-x 1 root root 30764 2006-07-20 22:14 /usr/sbin/cron
/var/www:
total 8
drwxr-xr-x 2 root root 4096 2007-01-02 07:48 apache2-default
drwxr-xr-x 9 root root 4096 2007-05-10 11:01 htdocs
root@seq2:~# ls -l `which cron` /var/www/htdocs
-rwxr-xr-x 1 root root 30764 2006-07-20 22:14 /usr/sbin/cron
/var/www/htdocs:
total 48
drwxr-xr-x 3 root root 4096 2007-01-08 11:26 advanta
drwxr-xr-x 3 root root 4096 2007-02-05 11:47 aegon
drwxrwxrwx 3 root root 4096 2007-05-18 07:49 daily_edts
drwxrwxrwx 4 root root 4096 2007-05-22 10:33 daily_reports
-rw-r--r-- 1 root root 3549 2007-03-19 12:03 import.sql
-rw-r--r-- 1 root root 72 2007-01-02 13:08 index.php
-rw-r--r-- 1 root root 3045 2007-03-21 08:17 junk.sql
drwxr-xr-x 2 root root 4096 2007-04-30 10:29 kentest
-rw-r--r-- 1 root root 5321 2007-03-28 11:17 lifedata.php
drwxr-xr-x 2 root root 4096 2007-04-30 11:02 linc
drwxr-xr-x 2 root root 4096 2007-03-29 15:05 ptt
root@seq2:~# ls -l `which cron` /var/www/htdocs/daily_edts
-rwxr-xr-x 1 root root 30764 2006-07-20 22:14 /usr/sbin/cron
/var/www/htdocs/daily_edts:
total 80
-rw-r--r-- 1 root root 1704 2007-05-10 12:09 cont66outall.php
-rw-r--r-- 1 root root 2643 2007-05-17 09:40 dtreeedt.php
-rw-r--r-- 1 root root 1389 2007-05-11 14:21 dtreeleads.php
-rw-r--r-- 1 root root 1539 2007-05-11 14:21 edtcreate.php
-rw-r--r-- 1 root root 712 2007-05-17 13:51 edts.php
-rw-r--r-- 1 root root 1012 2007-05-17 12:14 edttest.php
-rw-r--r-- 1 root root 856 2007-05-10 13:44 functlib.php
-rw-r--r-- 1 root root 2367 2007-05-10 13:44 ibcibedt.php
-rw-r--r-- 1 root root 1326 2007-05-10 13:54 kitxls.php
-rw-r--r-- 1 root root 1482 2007-05-11 13:42 medall.php
-rw-r--r-- 1 root root 1158 2007-05-11 13:42 multiedt.php
-rw-r--r-- 1 root root 19349 2007-05-10 13:11 mysqlclass.php
-rw-r--r-- 1 root root 1240 2007-05-10 14:00 outfin.php
-rw-r--r-- 1 root root 991 2007-05-10 13:57 outnew.php
-rw-r--r-- 1 root root 998 2007-05-10 13:59 outunf.php
drwxrwxrwx 2 mysql mysql 4096 2007-05-18 07:01 sheets
Posted: Tue May 22, 2007 10:46 am
by Jenk
no, to check /var, run
and look at the corresponding items for /var, for www
and so on.
Posted: Tue May 22, 2007 12:07 pm
by kbrown3074
K..here we go...
Code: Select all
root@seq2:/var/www/htdocs/daily_reports/sheets# ls -l /
total 112
drwxr-xr-x 2 root root 4096 2007-02-13 07:21 bin
drwxr-xr-x 3 root root 4096 2007-02-13 07:21 boot
lrwxrwxrwx 1 root root 11 2007-01-02 07:41 cdrom -> media/cdrom
drwxr-xr-x 11 root root 13260 2007-05-22 06:25 dev
drwxr-xr-x 62 root root 4096 2007-05-17 10:08 etc
drwxr-xr-x 3 root root 4096 2007-01-02 07:51 home
drwxr-xr-x 2 root root 4096 2007-01-02 07:43 initrd
lrwxrwxrwx 1 root root 32 2007-01-02 07:47 initrd.img -> boot/initrd.img-2.6.17-10-server
drwxr-xr-x 15 root root 8192 2007-02-13 07:21 lib
drwxr-xr-x 2 root root 49152 2007-01-02 07:41 lost+found
drwxr-xr-x 4 root root 4096 2007-01-02 07:41 media
drwxr-xr-x 2 root root 4096 2007-04-10 10:28 mnt
drwxr-xr-x 2 root root 4096 2007-01-02 07:43 opt
dr-xr-xr-x 66 root root 0 2007-04-24 03:33 proc
drwxr-xr-x 4 root root 4096 2007-05-22 11:05 root
drwxr-xr-x 2 root root 4096 2007-02-13 07:21 sbin
drwxr-xr-x 2 root root 4096 2007-01-02 07:43 srv
drwxr-xr-x 11 root root 0 2007-04-24 03:33 sys
drwxrwxrwt 4 root root 4096 2007-05-22 12:49 tmp
drwxr-xr-x 11 root root 4096 2007-01-02 07:43 usr
drwxr-xr-x 14 root root 4096 2007-01-02 07:48 var
lrwxrwxrwx 1 root root 29 2007-01-02 07:47 vmlinuz -> boot/vmlinuz-2.6.17-10-server
root@seq2:/var/www/htdocs/daily_reports/sheets#
root@seq2:/var/www/htdocs/daily_reports/sheets# ls -l /var
total 40
drwxr-xr-x 2 root root 4096 2007-03-09 06:25 backups
drwxr-xr-x 8 root root 4096 2007-01-02 07:48 cache
drwxr-xr-x 21 root root 4096 2007-01-31 11:26 lib
drwxrwsr-x 2 root staff 4096 2006-10-19 18:49 local
drwxrwxrwt 3 root root 60 2007-04-24 07:33 lock
drwxr-xr-x 8 root root 4096 2007-05-22 06:25 log
drwxrwsr-x 2 root mail 4096 2007-01-02 07:43 mail
drwxr-xr-x 2 root root 4096 2007-01-02 07:43 opt
drwxr-xr-x 8 root root 320 2007-05-22 06:25 run
drwxr-xr-x 3 root root 4096 2007-01-02 07:48 spool
drwxrwxrwt 2 root root 4096 2007-05-14 08:19 tmp
drwxr-xr-x 4 root root 4096 2007-01-02 13:04 www
root@seq2:/var/www/htdocs/daily_reports/sheets#
root@seq2:/var/www/htdocs/daily_reports/sheets# ls -l /var/www
total 8
drwxr-xr-x 2 root root 4096 2007-01-02 07:48 apache2-default
drwxr-xr-x 9 root root 4096 2007-05-10 11:01 htdocs
root@seq2:/var/www/htdocs/daily_reports/sheets#
root@seq2:/var/www/htdocs/daily_reports/sheets# ls -l /var/www/htdocs
total 48
drwxr-xr-x 3 root root 4096 2007-01-08 11:26 advanta
drwxr-xr-x 3 root root 4096 2007-02-05 11:47 aegon
drwxrwxrwx 3 root root 4096 2007-05-18 07:49 daily_edts
drwxrwxrwx 4 root root 4096 2007-05-22 12:53 daily_reports
-rw-r--r-- 1 root root 3549 2007-03-19 12:03 import.sql
-rw-r--r-- 1 root root 72 2007-01-02 13:08 index.php
-rw-r--r-- 1 root root 3045 2007-03-21 08:17 junk.sql
drwxr-xr-x 2 root root 4096 2007-04-30 10:29 kentest
-rw-r--r-- 1 root root 5321 2007-03-28 11:17 lifedata.php
drwxr-xr-x 2 root root 4096 2007-04-30 11:02 linc
drwxr-xr-x 2 root root 4096 2007-03-29 15:05 ptt
root@seq2:/var/www/htdocs/daily_reports/sheets#
root@seq2:/var/www/htdocs/daily_reports/sheets# ls -l /var/www/htdocs/daily_edts
total 80
-rw-r--r-- 1 root root 1704 2007-05-10 12:09 cont66outall.php
-rw-r--r-- 1 root root 2643 2007-05-17 09:40 dtreeedt.php
-rw-r--r-- 1 root root 1389 2007-05-11 14:21 dtreeleads.php
-rw-r--r-- 1 root root 1539 2007-05-11 14:21 edtcreate.php
-rw-r--r-- 1 root root 712 2007-05-17 13:51 edts.php
-rw-r--r-- 1 root root 1012 2007-05-17 12:14 edttest.php
-rw-r--r-- 1 root root 856 2007-05-10 13:44 functlib.php
-rw-r--r-- 1 root root 2367 2007-05-10 13:44 ibcibedt.php
-rw-r--r-- 1 root root 1326 2007-05-10 13:54 kitxls.php
-rw-r--r-- 1 root root 1482 2007-05-11 13:42 medall.php
-rw-r--r-- 1 root root 1158 2007-05-11 13:42 multiedt.php
-rw-r--r-- 1 root root 19349 2007-05-10 13:11 mysqlclass.php
-rw-r--r-- 1 root root 1240 2007-05-10 14:00 outfin.php
-rw-r--r-- 1 root root 991 2007-05-10 13:57 outnew.php
-rw-r--r-- 1 root root 998 2007-05-10 13:59 outunf.php
drwxrwxrwx 2 mysql mysql 4096 2007-05-18 07:01 sheets
root@seq2:/var/www/htdocs/daily_reports/sheets#
root@seq2:/var/www/htdocs/daily_reports/sheets# ls -l /var/www/htdocs/daily_edts/sheets
total 0
root@seq2:/var/www/htdocs/daily_reports/sheets#
Posted: Tue May 29, 2007 10:00 am
by kbrown3074
Still having the same problems. Is there a cron user I can set a .sh file to in order to create the files?
Posted: Tue May 29, 2007 10:07 am
by Jenk
Sorry, forgot about this thread.
cron will only need read and execute access to a .sh script to execute it, so that will work.
As for the actual problem of cron not being able to access/create the output file, I'm all out of ideas. Sorry. Unless you have a cron.deny file somewhere (usually in /etc) preventing your cron user from creating files?
Posted: Wed Jun 06, 2007 12:46 pm
by kbrown3074
the way the page was creating the file wasnt allowing me to write it..I changed to a function call instead of calling a new page and it worked...weird!