Running php from cron - working up to a point


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Running php from cron - working up to a point
# 1  
Old 09-01-2010
Running php from cron - working up to a point

Hi there, I am struggling to try and work out what is going wrong with a cron job i have running daily which opens up an imap mailbox and extracts a rar file to a directory on the web server. The script works ok when run manually, and when it is running from cron, I can see that it opens up the mailbox and reads unread messages, however, there seems to be an issue with extracting the rar file when running from the cron. Permissions are set to 777 on the relevant folder where the rar is being extracted to, so I'm not sure what's going
on.

My cron line is as follows:
Code:
05 20  * * * nicky /usr/bin/php -q /u01/www/vhosts/www.mysite.co.uk/httpdocs/imap_get_rars.php >/dev/null

I'm a bit of a linux newb so any pointers in the right direction (or how to catch errors in this situation) would be great!
# 2  
Old 09-01-2010
Your php script does not show any error?

Try the following:
Code:
exec 1>> <path-to-log>/phpScriptExec.log; exec 2>> <path-to-log>/phpScriptExec.err; /usr/bin/php -q /u01/www/vhosts/www.mysite.co.uk/httpdocs/imap_get_rars.php

Change the exec part of the crontab line and it will place an error in the <path-to-log>/phpScriptExec.err.

Regards.
# 3  
Old 09-01-2010
Thanks felipe, that helped me track down the problem. Some relative paths in my php script which I've changed to absolute and all working now.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Crontab - entry not working , cron job not running

I have put a cron entry in oracle user for taking hot backup every wednesday@ 2.30 AM and have given the cron entry 30 02 * * 3 /u01/vijay/hotbackupcron 2>&1 >> /u01/vijay/hotbackup.log also find below the script inside hotbackupcron, i have put in env variables as well ... (13 Replies)
Discussion started by: vijaymec50
13 Replies

2. Solaris

Cron job running even after cron is removed

Hi , I have removed a cron for particular user , but cron job seems to be running even after the cron entry is removed. The purpose of the cron was to sendmail to user ( it uses mailx utility ) I have restarted cron and sendmail service still user is getting mail alerts from the cron job. And... (4 Replies)
Discussion started by: chidori
4 Replies

3. Shell Programming and Scripting

Script not working in cron but working fine manually

Help. My script is working fine when executed manually but the cron seems not to catch up the command when registered. The script is as follow: #!/bin/sh for file in file_1.txt file_2.txt file_3.txt do awk '{ print "0" }' $file > tmp.tmp mv tmp.tmp $file done And the cron... (2 Replies)
Discussion started by: jasperux
2 Replies

4. Shell Programming and Scripting

Getting issue while running it from cron while manually working fine

Hello, I am working one one script where I am using the below code which is using to connect with MKS client when I run my script manually it works effiecently i.e. it connects with MKS client but when I run it from CRON it doesn't connect. 1)Can some one tell when it is running from cron... (1 Reply)
Discussion started by: anuragpgtgerman
1 Replies

5. Shell Programming and Scripting

Script is not working from cron while working manually

Hello, I am facing a very strange problem when I run my script manuallu ./Fetchcode which is using to connect with MKS integrity from linux end it workks fine but when I run it from cron it doesn't work.Can someone help me 1) How could I check my script when it is running from cron like... (3 Replies)
Discussion started by: anuragpgtgerman
3 Replies

6. UNIX for Advanced & Expert Users

Running multiple php scripts into one php only, cron mail alert problem...

hi, while separated they produce the usual mail alert and i can see the output... if i write into the php script: <?php system('php -f /var/www/vhosts/domain.com/httpdocs/folder/script1.php'); system('php -f /var/www/vhosts/domain.com/httpdocs/folder/script2.php'); system('php -f... (0 Replies)
Discussion started by: 7stars
0 Replies

7. Shell Programming and Scripting

running a script only till a point in a day

how can i run the script if its less than a particular time only in unix. for e.g the script kicks off at 9AM and looks for some file etc. I want to make sure it runs only till 12PM and then succeed the job and proceed regardless if the file exists or not. how can we do this (1 Reply)
Discussion started by: dsravan
1 Replies

8. Shell Programming and Scripting

[PHP] endless loop mimics a cron. Make sure only one instance is running

Hi, PHP user here. I'm using an endless loop to perform to mimic a cron. The script does something every 20 minutes. It sleep()s in the meantime. I have various checks that ensure that only instance can run, including a "gentleman agreement" locked file. However, I'd like to make sure... (2 Replies)
Discussion started by: jjshell
2 Replies

9. Shell Programming and Scripting

running script in cron - with ssh commands - not working

I ran an ssh command to run a script on a remote server ssh -l <user> <servername> /path/to/script/scriptname This works fine - and the script is executed correctly. However - I put this command into a script, that I want to run from cron every hour, to execute the file on the remote... (31 Replies)
Discussion started by: frustrated1
31 Replies

10. UNIX for Dummies Questions & Answers

Cron not working

I created a file in /u01/oradata directory as cronjb.ksh which contains following script 30 12 * * * /export/home/oracle/u01/oradata/rman.ksh '/export/home/oracle' is my root directory. I then moved cronjb.ksh file to my '/export/home/oracle' directory. i typed crontab cronjb.ksh. However my... (1 Reply)
Discussion started by: manna
1 Replies
Login or Register to Ask a Question