Find the answer to your Linux question:
Results 1 to 3 of 3
I've got a bash script that invokes some php scripts that in turn do some data manipulation, return some files that the bash script then compresses (zips). The bash file ...
  1. #1
    Just Joined!
    Join Date
    Feb 2007
    Posts
    3

    Problem with bash, cron and php interaction

    I've got a bash script that invokes some php scripts that in turn do some data manipulation, return some files that the bash script then compresses (zips). The bash file and the php scripts work fine when invoked from the CLI, but do not work when invoked from cron. Cron runs the shell script fine.

    The area of the Bash script that contains the php invoking looks like:

    Code:
    if [ "$curperiod" == "$period" ]; then
    
    	if [ -s $zipfilename ]; then
    		echo "There is already a zip file present for that date"
    		exit
    	else
    			/usr/local/bin/php -q results_0001_1.php >> data.log
    			/usr/local/bin/php -q results_0001_4.php >> data.log
    			/usr/local/bin/php -q results_month.php >> data.log
    			/usr/local/bin/php -q results_week.php >> data.log
    		
    		echo "The following files were created:" > /home/email_log
    		
    		#list the files and their sizes
    		du -a $DIR/*.csv >> /home/email_log
    I know that I'm 'getting' into the else statement fine.

    Stumped.

  2. #2
    Just Joined! Sivel's Avatar
    Join Date
    Jun 2005
    Location
    Maryland
    Posts
    20
    Perhaps your problem is because you aren't using exact paths to your files. Maybe you should modify your file names to include the full path to the file.

  3. #3
    Just Joined!
    Join Date
    Feb 2007
    Posts
    3
    Thanks Matt. That was it and I feel like an idiot. Forest through the trees and all that.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...