views:

172

answers:

1

Hello,

I'm a php developer using capistrano, with multistage support, to deploy my application to my production servers. Hence, I have very little ruby or rails knowledge.

I've figured out enough to add a new function called 'flush' to my deploy.rb script which invokes a php script on all my production servers. The purpose of the 'flush' is to connect to each production server and execute a php script which writes all the logs from each server's local mysql tables to my master db.

I am sure that the function works since executing it from the command line (cap prod flush) produces accurate results.

I would like to schedule a cron job that invokes this function every hour. To start, I wrote a bash script that executes the function:

!#/bin/bash
`/usr/bin/cap prod flush`

However, when the cron job runs the script, it emails me back the following error:

the task 'prod' does not exist

I believe the problem is when the cron is run, its not executing the script in the proper directory. I've tried changing the $PATH and $HOME variable in the bash scripts, but I cannot seem to get it to work.

Could anyone offer me assistance?

Thanks!

A: 

change to

cd /path/where/deploy.rb/exists
cap prod flush

or

cd /your/app/path/    
cap prod flush
Rafael Mueller