I need cron job for my new application and found a nice add-on by DarkSide, but im having some difficulties using it.
The add-on is here: https://github.com/romaninsh/TemaOrig/tree/master/ds-addons/Scheduler
I have installed it till step 3, where windows scheduler reports "The windows cannot find the file specified".. but i guess i will try this tommorow.
What im really interested is some example of configuration (step4)
4a) Set scheduler global settings in "Config" tab.: How should i insert them, directly into database? So how do i insert: Important is, that you set "Heartbeat time" to exactly the same value (in minutes) what scheduled in your cron tab or Windows task scheduler.
Just a guess:
name: Heartbeat time
value: 5? Like every 5 minutes? Or do i put cron expression?
description: ??
4b) Create Tasks.
I really do not know how to use this. What do i insert for Code, Class, Action?
Actually original source of ds-addons is here: https://github.com/DarkSide666/ds-addons and I'm author of this addons pack and particular add-on - Scheduler :)
Questions and tips for you:
What is folder structure in your project folder? I'm of course especially interested where ds-addons folder is located.
Which version of Windows are you using and do you have Administrator rights on that machine?
Can you find file wscript.exe in your system hard-drive / Windows installation folder? In my WinXP it's located in c:\windows\system32 folder and as result is in PATH environmental variable and is accessible from anywhere. If that's not your case, then you have to provide full path to wscript.exe
4a is no more needed in latest version of add-on
There is a sample Task class in readme in latest version of add-on
In Windows scheduler you can set script to execute every minute or every 3-5 minutes not less. Otherwise you'll have big delays between scheduled time (in add-on) and actual execution time.
Solution:
Download latest add-on version from https://github.com/DarkSide666/ds-addons and check out changes in it's readme file.
Related
I am trying to run a cron-job that automates the cache rebuild function of Woo Search Box plugin.
The plugin has this dynamic cron command, that I set to run once a day at 1AM:
php /home/carit/public_html/index.php 16021417635f7ebe43c604a
I am well experienced with cron jobs inside of C-Panel but I can't figure out what prevents this cron from running. All in all, I have tried what the documentation suggests here, also tried usr/bin/php instead of php but it didn't make any difference.
If I run this cron-job inside my server's terminal, it works like a charm and the cache is being rebuilt. It only seems to not be working when I run it via cron-job.
Does anyone have any suggestions or ideas on why doesn't this cron-job works?
Please correct me in the comments in case I forgot to provide any key information about my problem,
Thanks.
It seems that some newer versions of CentOs or Ubuntu servers use either /usr/local/bin/php or simply /usr/bin/php. If you have ftp access to the server you want the cron to run in, make sure to check for the php file in both paths recommended above before trying to use the ordinary php before a cron job.
I am currently working on the project that has over 20 crons. Some of them are pretty long processes. It was built on Symfony 2.8, so we decided to upgrade it to 3.4 LTS.
After the upgrade we noticed that, if there is ongoing cron job (long process) and we push some changes to Prod environment we get this error:
Fatal Compile Error: require(): Failed opening required '/.../cache/prod/
Turns out, that when we deploy the changes, cached container (in var/cache/prod/ContainerXXXXXX) changed the XXXXXX value. Or in other words, we clear the cache (during deploy) and then it generates new Container in cache directory. More about this problem: https://github.com/symfony/symfony/issues/25654 .
So, I came up with the idea, add a script with a while loop (?) which checks if there is any running crons, if not run the deploy.
But the question is, is there a way to check this in current situation?
There are many ways to achieve this. Just any kind of semaphore (a file, a database record) to store the "running" status and have the same process clear it when it's done.
Any deployment job should check the value of this semaphore before continuing. A simple flat file would be easiest, since you may not have access to more sophisticated features during deployment, but reading a text file should be easy no matter what kind of of deployment process you are using.
Last week, I tried to deploy a simple symfony app on azure.
I choose the plan app service B2 (2cores / 3.5Go RAM).
PHP Version : 5.6.
First it took forever to complete the composer install. (I tried to go on S3, it was a little faster but not very different).
So I tried to optimize the php config, opcache, realpath_cache_size...etc (xdebug already disabled).
I even tried to enable wincache, but with no real improvment.
So now my app is deployed, but it is too slow to be usable.
A simple php app/console (in dev mode) takes ~23secondes.
It seems to recreate the cache everytime. On my local unix environnment (similar specs), it takes 6seconds when the cache is cold and 500ms when the dev cache is warm.
I think that the main problem is a filesystem issue, because to remove the dev cache folder it takes 16 seconds.
On my local unix environnment, similar specs, it takes ~200ms to remove the same folder.
Like I said I tried S3 Plan with a small improvment but not enough to explain this slowness.
One thing weird, it's that if I rerun the command php app/console just after it finished, the command takes 5seconds to run (much better). But If rerun it 5seconds after it finished, it takes 23seconds.
I already tried these solutions (even if the environnment is different) :
https://stackoverflow.com/a/17021255/6309878
Update : I tried to set the symfony app/cache folder to the local filesystem D:\local\cache, but no improvment, it may be worst.
Please try below steps and let me know if it improves the performance -
1) In the wwwroot directory of your site, create a .user.ini file (if it doesn’t already exist) and add “wincache.fcenabled=0”. This will disable Wincache.
2) Go to Azure Portal and go to the Application Settings for your app. In the App Settings section, add “WEBSITES_DYNAMIC_CACHE” with a value of 1.
3) Restart the site.
I'm sure there are answers for this all over stackoverflow but I was unable to find anything specific.
I have a PHP project which I am revisiting. Its running on a RHEL5 box. I have SVN on the same box.
Out of curiosity I recently added Jenkins to the machine and have the jenkins php template at...
http://jenkins-php.org/
There was a bit of playing around with the setup but I more or less have this all running and doing Continuous Inspection builds when something is committed to SVN.
What I want to do now is have Jenkins copy my updated files across to the server when the build completes.
I am running a simple LAMP setup and would ideally only like to copy across the files that have actually changed.
Should I just use ANT & sync? Currently the files reside on the same box as the server but this may change whereby I will need to sync these files across to multiple remote boxes.
Thanks
Check these - Copy Artifact Plugin and the job's env variables.
Now set 2 jobs - 1 on source machine and 1 on destination server (make it a slave). Use the plugin to copy required artifacts by using environment variables.
Do you have your project (not the jenkins but that with LAMP setup) under the SVN? If yes I'd recommend to create standalone job in Jenkins that will just do an svn up and you could tie it to jenkins job the way like - you running your main job, and if build is ok jenkins automatically runs job to update your project.
For copying to other servers take a look at Publish Over plugins
It's very easy to setup server and rules. The bad thing is that you can't setup copying only the new files for current build which means that the entire project is uploaded every build.
If your project is too big, another solution is to use rsync as post build action.
I work a lot with the WindowsAzure4E(clipse) IDE. And it's always pain to wait for the local test deployment)
Isn't there a way to develop on the deployed PHP files which must be stored somewhere to inetput or something else?
thx for your ideas.
Yes! In fact, I just got this working myself yesterday.
After installing PHP 5.3 with CGI support for IIS (making the necessary php.ini modifications of course), I simply created a new site in IIS that mapped to a role in the workspace for my Eclipse project.
Keep in mind that there's one hiccup to this and that is that the php_azure.dll file, used to access the service configuration and mount azure drives, was built to run in the azure fabric (either development or hosted). In my case, I don't NEED these features so I removed referrences to things like getconfig and poof the project loads in IIS just fine. I only need to make sure I start Azure Storage prior to launching the application.
I've been told that some folks are able to update their systems path environment variable with the location of the azure diagnostics dll (diagnostics.dll) and have it work without this modification. But this route didn't work for me. :(
I'll actually be blogging on this more this weekend as it took me a week of evenings to get things sorted out.
I found out that after the deployment the project files are copied to the folder ServiceDefinition.csx.
When you now edit the source code in this place, you can see the changes directly, without another deployment.