I'm using the CakePHP Console to download files from we and processed in a database. I'm running the console from inside the "app" directory. But when I'm trying to run the console outside app and by just setting the "-app" parameter for my cron job, it doesn't work.
To be honest, I've had no success using -app parameter. It's like it's not working at all.
By the way, I'm using Windows & Pycron for my cron jobs.
Here's what happens when I'm trying to run the console from D:\
D:\>web\elink\cake\console\cake -app D:\web\elink\app
Welcome to CakePHP v1.2.2.8120 Console
---------------------------------------------------------------
Current Paths:
-app: app
-working: D: -app D:/web/elink/app
-root: D: -app D:/web/elink
-core: D:\web\elink
Changing Paths:
your working path should be the same as your application path
to change your path use the '-app' param.
Example: -app relative/path/to/myapp or -app /absolute/path/to/myapp
Available Shells:
D:\web\elink\vendors\shells:
- none
CORE\console\libs:
acl
api
bake
console
i18n
schema
testsuite
To run a command, type 'cake shell_name [args]'
To get help on a specific command, type 'cake shell_name help'
My shells are located at D:\web\elink\app\vendors\shells.
I have managed to reproduce this issue using versions 1.2.2.8120 and 1.2.3.8166 on Windows. The -app parameter doesn't seem to work at all as expected.
The console will only list global shells in the /vendors/shells folder and not application-specific ones located in /app/vendors/shells or in plugins (/app/plugins/plugin_name/vendors/shells).
The -app parameter works as expected on OpenSUSE, listing all available application-specific shells (including those in plugins).
Unless we are doing something incorrectly, it is probably worth opening a ticket on Trac about this issue.
A workaround would be to add your Cake console directory to the Windows PATH environment variable.
Open 'System Properties' (Start key + Pause/Break key)
Open 'Advanced' tab
Click 'Environment Variables'
Select the PATH variable in the 'System variables' section
Press 'Edit'
Append ;E:\web\elink\cake\console\ to the 'Variable value'
Press 'Okay' on all dialogs
Close all open cmd prompts
You can then set up pycron to run E:\web\elink\cake without the -app parameter and all your application-specific shells should be available.
-For the people having the same problem but on linux systems, here there is an easy solution:
http://book.cakephp.org/complete/3/The-Manual#Running-Shells-as-cronjobs-846
-Another alternative solution for any system would be to create a simple script with two lines like this:
cd /path/to/app
/path/to/cake
-Both solutions worked for me in a Cent0S and in a MacOS based machines.
Related
I am trying to configure the "Run Settings" on Qt Creator 3.0.1.
I would like to set the value of many environment variables by sourcing a shell script 'myScript'.
However, Deployment's Custom Process Step apparently doesn't accept 'source' as a command.
If I execute the script instead of sourcing it, it sets the environment variables of the shell process in which it is executed, which is not the same where Qt Creator runs the executable.
Is it possible to use 'myScript' to configure the environment variables ? How should I call it?
Ofcorse, You can run qt via scrypt. This is very simply. My script is below. Ofcorse you need environment variables in concret file. In my case this file is environment-setup
#!/bin/bash
echo "ustawienie zmiennej /usr/local/angstrom/arm/environment-setup"
# set concret variables important is . /
. /usr/local/angstrom/arm/environment-setup
echo "Uruchomienie qtCreator"
# lunched qtcreator
$HOME/Qt/Tools/QtCreator/bin/qtcreator
You also can set this script as linked to main icon qt in your start menu. After this, all you need to run qt is only click in your shortcut in menu
I think currently there's no proper way to set QtCreator build environment variables using a script. For example in this guide by ICS three options are mentioned in the "Set Up the Environment" section:
1. You can always start Qt Creator in the same shell/console session where you previously ran the environment setup script (i.e. /opt/poky/2.2.1/environment-setup-armv5e-poky-linux-gnueabi). This option is the easiest, but means that you can’t simply launch Qt Creator from a desktop shortcut or similar method. It might also cause problems if you want to build for the desktop or another embedded platform within the same session.
2. You can add the environment variables to the kit’s settings. This option is a little more work to set up, but avoids the issues of the shell setup.
3. A third option is to add the environment variables to your project settings, but that means adding it to every project that uses the kit.
I followed steps mentioned in this link http://maven.apache.org/download.cgi
Whenever I type mvn --version in cmd.
I got 'mvn' is not recognized as an internal or external command, operable program or batch file.
But when I opened cmd with "Run as a administrator" it worked.
OS: windows 8
How can I run mvn for any user on windows 8.
Try setting the environment variable M2 as System variable instead of User variable.
I used Rapid Environment Editor, started as an Administrator, and put these variables into my System path, and this problem went away.
For some reason, when I added the the JDK, JRE, and Maven bin folders to my Path through the Windows utility, it didn't work. Rapid Environment Editor told me that the variables were not valid or I did not have access to them. Windows 8 seems to be really picky about administrator rights and I guess they didn't think that through very well.
Just be sure to start Rapid Environment Editor as an administrator, and re-open your command windows when you save your changes.
I had to move the installation directory of Maven into C:\Users*your_username*, so that Maven no longer required admin permissions. The PATH variables started working after that.
Set the MAVEN/M2 and MAVEN_HOME/M2_HOME variables in the environment variables in windows 8, this will solve the problem.
I'm using chinese version so that i'm not sure what's these word in english version.
click right button on "My computer"
click last item on list
click "Advanced system setting" at left side
"Evironment Variable"
append maven's bin directory into system's environment variables path
after all, try linux
The simplest way is:
Add maven directory to the path in systems variable.
don't add anything in user variable and no need to add any variable.
faced the same problem; The bins or files from path for M2_home and Java_home need to be found in a directory where the user has full control permission. Change the security permission settings of the user through the administrator by right click on the order, go to properties->security tab and check the Full control box for "authenticated user" and "user".
I am having strange problem. I used to run appcfg.py to update my app to appengine but now its not working anymore. When I run this command
C:\Program Files <x86>\Google\google_appengine>appcfg.py update E:\path\myApp\
Its not giving me anything, no error no feedback. Its just back to this line
C:\Program Files <x86>\Google\google_appengine>
Any idea about this issue!
P.S. I'm using Python 2.7. My code is updating through google app launcher but I need to run it from cmd prompt as I will be downloading/uploading appengine stuff which launcher doesn't allow me to do!
Thanks
I still had a little trouble with the instructions. Here's the steps I used to create a batch file to use the Google App Engine download_app with Windows 7.
In my example,
I'll use drive, C:
Default python path will be, C:\Python27\python.exe
GAE path (include "), "C:\Program Files (x86)\Google\google_appengine\appcfg.py"
App ID {your_app_id} will be just your app-id name
{your_app_version} is the "Version:" number in your GAE app.yaml file
I'll create a folder on my Windows 7 desktop and call it GAE_App
The desktop folder path will be C:\Users\{username}\Desktop\GAE_App
{your email} will be the Gmail account connected to your GAE
Right-click on the desktop and select New->Text Document. Open the newly created text document and add the following line of code modified for your setup to the blank text document,
C:\Python27\python.exe "C:\Program Files (x86)\Google\google_appengine\appcfg.py" download_app -A {your_app_id} -V {your_app_version} --email={your email} C:\Users\{username}\Desktop\GAE_App
Save the text document and change the file name to GAE_Download.bat
It's important that the extension now says ".bat" instead of ".txt"
Once finished, click on the batch to execute it. You'll be asked for a password and then the files should download into the GAE_App folder on your desktop. Now, whenever you need to download your files, just click on the batch file.
Not sure why Google didn't simply include this feature with their GAE for Windows software.
I faced the same issue. Here is a simple solution.
Just do this following Steps:
Go to program file where google app engine is installed. Generally It is named as Google.
click on appcfg.py and select open with.. Select "Choose Default Programs".
Select Python from programs and select "Always Use the selected program to open this kind of file" .
Now run the command you should get the results on command line.
For reference click here
Fixed by accessing python lib like that
C:\Python27>python appcfg.py update E:\path\myApp\
Here's a solution that worked for me:
"google_appengine/appcfg.py" update "C:\PATH TO APP
The appcfg.bat that should be used is located **C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\appengine-java-sdk\bin** and not the empty appcfg.bat that for some unknown reason also was here C:\Program Files\Google\Cloud SDK\
Good practice is to add this path to the system variable PATH
This worked for me
Basis
<PATH_TO_PYTHON>python <PATH_TO_APPCFG.PY>appcfg.py -A <PROJECT_INSTANCE_NAME> update app.yaml
Example
X:\Software\Python2.7\python Q:\SOFTWARE\GoogleAppEngineSDK\appcfg.py -A great-1337 update app.yaml
I installed Jenkins om my Snow Leopard laptop. I assigned the user "jenkins" to it's home dir etc. Next, I basically followed this tutorial.
Now, when I run a build, I get an error:
/Users/Shared/Jenkins/Home/jobs/projectname/workspace/build.xml:78: Execute failed: java.io.IOException: Cannot run program "phpmd": error=2, No such file or directory
Also, he gives the same errors for phploc etc.
When I run phpmd on the commandline, everything is fine. Also when I login as user jenkins with "su jenkins" and I try to run the command on the command line, everything is fine too.
I believe the problem is that Jenkins is unable to find the command. Probably because it's not in the /usr/bin dir? I added a .bash_profile file with the export path to /usr/local/bin, but even that doesn't make a difference. So, anyone know what exactly the problem is?
You can see the environment variables (including the PATH) under "System Information" on the page of the slave. You can adjust these variables as well as set tool locations on the slave configuration page. To get to those pages, click on the name of a slave on the main page.
I tried to set the PATH environment variable as described above, ie
"manage nodes"->"[node]"->"configure"
and then "name" PATH and "value" /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
For some reason this did not work - I visited "manage nodes"->"[node]"->"system info"
and the PATH value had not changed and the job continued to not work.
This was with version 1.462 and slave.jar 2.13.
My workaround was to set an explicit path for the tool (git in my case) in the "tool locations" section of the node configuration page.
I kindly suggest to replace your phpmd command by a "echo $PATH" so you can see what's in the PATH in the context where you are starting phpmd.
I have created a jar file in java, and I want to make the application automatically start during system boot up. I found I have to write a shell script for that. What should be that shell script look like? Is there anything else I have to do to make an application automatically start at boot up?
The preferred way to launch programs at OS X startup is to create a launchd daemon as explained here.
In mac os x you can also just run "open program.jar" (or any folder, '-a' for native applications) and it will open detached from the terminal with any default environment settings that it would use if you just double clicked it.
You can also add a program (or the script) to the user's login items through System Preferences > Accounts > 'username' > Login items. This is completely point and click and doesn't require a shell script
The shellscript would be something like this:
cd /directory/to/jar
java -jar Jar.jar
Or maybe you don't actually need to write Jar.jar, only Jar. I don't quite remember.