I want to execute a shell script in every minute. I used this command
* * * * * cd /opt/bitnami/apache2/htdocs/sitename/app && Console/cake Sendnotification
Where Sendnotification
is the shell name and sitename
site folder name.
Please let me know. I have been trying to fix this since from last 10 hours.
This is because PHP installed in non-standard path. You will need to edit the Console/cake
bake shell script to include the path to PHP executable.
Since you are using Bitnami , you can add the following line to the shell script:
export PATH=/opt/bitnami/php/bin:$PATH
So your Console/cake file should look like this:
#!/usr/bin/env bash
export PATH=/opt/bitnami/php/bin:$PATH
################################################################################
#
# Bake is a shell script for running CakePHP bake script
#
# CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
# Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
...
(This works for me on CakePHP 2.x)
Bonus : You can edit your cron task to log the console output to a file for debugging:
* * * * * cd /opt/bitnami/apache2/htdocs/sitename/app && Console/cake Sendnotification > /opt/bitnami/apache2/htdocs/sitename/logs/Sendnotification_`date +\%Y\%m\%d`-cron.log 2>&1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.