currently I am using command to execute cron is
cd appfolder.
../cake/console/cake cronname
it is working on local linux server
but,
(1)
/home/chpltv/public_html/cron/cron/cake/console/cake -app "/home/chpltv/public_html/cron/cron/app" news_import_basic >> /home/chpltv/public_html/cron/a.txt
(2) sh ../home/chpltv/boxyourtvtrial.com/cake/console/cake.php -app "/home/chpltv/boxyourtvtrial.com/public_html/cron/cron/app/" news_import_basic >> /home/chpltv/public_html/cron/a.txt
it is not working.
I dont know wht is issue......
Please Help me
please tell me command to run cron in cake php
A shell is run from the app/vendors/shells directory within the application you have created. When you create the shell, if must also follow the same class structure as the other class based code in cake:
class ThisNewNameShell extends Shell {
// functions here
}
Then this shell is called run with the following command:
/path/to/cake/console/cake {name_of_shell} {name_of_function} {args} -app /path/to/app
If you still are not getting the desired results, turn on debugging and run the shell manually to see the output and fix any issues. Once they are resolved, you will have a working cron.
Happy Coding!
Without any error messages, it's hard to diagnose a problem.
Check your email or cron logs (possibly /var/log/cron) for error messages, they may help.
Check the permissions on your files to ensure the cron user can run the cake console etc.
Assuming you have php cli working fine (should be ok if you can run it manually on the same server), is it in the path when the cron executes?
Consider appending 2>/tmp/news_import_basic.err to the cron commands to capture any error messages to a log file.
Related
I am running my selenium test case using "mvn clean test" and its working fine.
When tried to run it from crontab , getting error chrome driver crashed.
Tried to write shell script and provide pom , code directory etc but its of no help
any suggestions?
Suggesting to inject into your cron script 2nd line:
source /home/<your username>/.bash_profile
This will insert into your cron script all the required environment context and paths.
I am using custom Nagios plugins for the first time and am running into this error when I create a service for the plugin.
(No output on stdout) stderr: execvp(/usr/local/nagios/libexec/check_load.py, ...) failed. errno is 2: No such file or directory
The plugin works when I run it on the command line, however does not work when it runs within Nagios.
I followed these steps to get the plugin into Nagios
https://assets.nagios.com/downloads/nagiosxi/docs/Managing-Plugins-in-Nagios-XI.pdf
Here is what it looks like in the Nagios UI
The plugin is in the correct path: /usr/local/nagios/libexec and the resource.cfg file has the same path within it.
I tried two separate plugins, both which work on the command line, and the result is the same error.
The error indicates the file location is incorrect, however the plugin is in the specified directory and runs with no errors within that directory.
I am totally stumped and appreciate any help.
For anyone reading this, I solved the problem.
The first time I added the plugin, I forgot to add the python extension. When I updated the already created plugin, Nagios still threw the error.
Once I completely deleted the plugin and re-created it the 'file not found', error went away.
I faced a similar issue when I was trying to add a custom plugin ( I had custom plugins in ruby and python ).
The issue was the missing shebang line at the start of the script (which determines the script's ability to be executed like a standalone executable).
For example, if you have a python plugin custom-plugin.py then make sure this script has shebang at the start of script #!/usr/bin/env python3. Also if you have other scripts (ruby, bash etc.) make sure to add the appropriate path at the start of your scripts.
Also, check the path for plugins Nagios version. For my setup path was /usr/local/nagios/libexec/ and make sure your custom plugin is executable and has correct ownership permissions.
Sample custom template I used :
define command {
command_name check_switch_health
command_line /usr/local/nagios/libexec/check_snmp.rb --host $HOSTADDRESS$ --model "$ARG1$" --community "$ARG2$"
}
The above workaround worked for me.
I am running a cakePHP app which is located in C:xammp\htdocs\scheduling. I am running it on xampp on Windows 7. I have added the following environment variables:
C:\xampp\htdocs\scheduling\app\Console\;C:\xampp\php;
but still cannot get the cakephp console in operation. When I navigate to C:\xampp\htdocs\scheduling\app and try to get the cake console or cake help, I am given a message that it is not recognized as an internal or external command.
And yes, I did reload the cmd after adding the environment variables.
Its Easy just follow the steps as mentioned below:
put Your PHP Path in environment Variable
Open Command Prompt with Admin priviliges
change directory to C:\xampp\htdocs\your_appname\app\console
Type in " Cake Bake " and run
And You Are ready to go...................Happy Baking...........................
Just reloading the cmd is not enough, you need to either reboot your system or add it once manually before you are ready to reboot:
set Path="%Path%;c:\xampp\htdocs\scheduling\app\Console"
If all else fails, you can always call it in full from your app dir:
Console\cake bake
It's a little bit more typing, but this will work regardless of the Path variable settings.
I'm trying to get my cake shell running on a linux server and having a challenge I know little about handling.
I'm running the following test shell called "cron" to ensure I am on the right cronjob setting:
*/1 * * * * cd /usr/www/users/everest1/ads2/app/app; ../cake/console/cake cron
At first I got "permission denied", which I fixed by updating the file permissions on the cake file. Now I just get this response...
../cake/console/cake: not found
I've even SSH'd to the cake/console directory itself and typed "cake" and still get the same error.
Does anyone have any ideas on how to solve this?
P.S. I'm not use to the SSH world at all or the command line on linux. Today was the first day editing the crontab file which took some reading up on.
Have you put the path of cake in $PATH var?
Ok, I managed to make this come right...
The first step was to read Running Shells as cronjobs
Once that was created I then got an error of "bad interpreter: No such file or directory", which I tracked down to being the first line of the cake shell script which I changed from #!/bin/bash to #!/usr/local/bin/bash
This then meant the file was being processed with the correct bash.
Once that was done, it all worked smoothly.
I have GWT app, which is deployed on GAE (Java). I'm trying to download data from App Engine datastore using appcfg.py . I did all the setup according to http://ikaisays.com/2010/06/10/using-the-bulkloader-with-java-app-engine/ .
GAE Python SDK version is 1.4.3
Python version is 2.5.4
appcfg.py is on my PATH. When I run appcfg.py on the command-line, I get the "help" message. But the problem is that no matter which command I use, it always returns the help message. I have not been able to run any command using appcfg.py.
It doesn't give any specific error message no matter what arguments I give. My app is using Google Accounts authentication, but I don't think it even gets to the point of authentication.
I'm able to use the Java appcfg (for other actions like rollback) without any problem. But the Python version simply refuses to work for all commands.
I've tried different formats like:
appcfg.py create_bulkloader_config --url=http://myappid.appspot.com/remote_api --application=myappid --filename=config.yml
appcfg.py create_bulkloader_config --filename=bulkloader.yaml --url=http://myappid.appspot.com/remote_api
appcfg.py --filename=bulkloader.yaml --url=http://myappid.appspot.com/remote_api create_bulkloader_config
All give me the same help message:
Usage: appcfg.py [options]
Action must be one of:
create_bulkloader_config: Create a bulkloader.yaml from a running application.
cron_info: Display information about cron jobs.
download_app: Download a previously-uploaded app.
download_data: Download entities from datastore.
help: Print help for a specific action.
request_logs: Write request logs in Apache common log format.
rollback: Rollback an in-progress update.
set_default_version: Set the default (serving) version.
update: Create or update an app version.
update_cron: Update application cron definitions.
update_dos: Update application dos definitions.
update_indexes: Update application indexes.
update_queues: Update application task queue definitions.
upload_data: Upload data records to datastore.
vacuum_indexes: Delete unused indexes from application.
Use 'help <action>' for a detailed description.
Options:
-h, --help Show the help message and exit.
-q, --quiet Print errors only.
-v, --verbose Print info level logs.
--noisy Print all logs.
-s SERVER, --server=SERVER
...
...
...
Even when I try "appcfg.py help create_bulkloader_config" for a detailed description, it still shows me the same standard help.
I have also tried on the local development server using the url http://127.0.0.1:8888/remote_api but it still gives the same help message.
I'm totally clueless as to what the problem is. I'm new to GWT and GAE, and any help will be appreciated.
Thanks.
The following fix worked for me. It looks like appcfg.py doesn't like PYTHON27 and ALWAYS returns the help menu. I fixed it by executing it with PYTHON25 and hard coded all my file locations:
C:\Python25-archive\python "C:\Program Files (x86)\Google\google_appengine\appcfg.py" rollback C:\scripts\myapp
The right way is to change the environment variables on Windows 7:
Go to System Properties
Go to Advance System Settings
Click on Environment Variables
Append to Path variable the values C:\Python27\
Click Ok and restart your computer. (Yes, it is needed.)
Another way is to:
Open command Prompt
Locate your python.exe file. For example:
C:\Python27>_
Then, run a python command that looks like this.
python <appcfg_directory> download_app -A <your_app_id> -V <your_app_version> <output-dir>
Where <appcfg_directory> is equal to C:\Program Files\Google\google_appengine\appcfg.py. (Depending on your file location)
Don't forget to put quotes before and after <appcfg_directory>