I am creating an app using magento 2 where user is supposed to upload csv file containing:
Name of base image
Name of clipart
height
Width
top margin
left margin
using above data I am suppose to combine both the images.
I am using cronjob to finish up this task, like as soon as user clicks on generate images first I am inserting all data into database and then using cron job, combining all the images after each minute.
The problem is cron job is still inserting data even after it has finished combining images. I want to stop cron job as soon as it finishes the task.
can I run cron job based on some condition or something?
The cron job always run by a schedule, so you have to add your condition within your code. Something like this:
if($this->isCombined()){
return false;
}
Cheers
Related
This sounds so simple in my head, but Power Automate doesn't like it.
I have a library with a lookup column. I have a Flow created which takes the filename of the document and puts this name into a "Title" column. Then I can use a lookup column on the Title column to find all the files in the library.
I've used "When a file is created or modified". Yet this flow runs constantly. No files are being update or modified at 1am, yet it still runs over and over. I've had an automated email telling me to fix this before it is disabled.
All I want it to do is run the damn flow ONLY when a file is updated or uploaded, just as its own function title suggested.
It would seem I need to add trigger rules, but all the guides I found were talking about checking if a specific person has modified it.
This used to be so simple with workflows, it would only run if something was modified or uploaded.
We have a SQL Server Agent job, which we need to run manually based on user/s request. The request is random and unfortunately, we cannot predict when the users will request it. Also, we have to it in after hours (Plus, it takes over an hour to run).
Anyways, I wanted to see if it was possible to run this job automatically based on a text file we can put on a Share drive. Users can update this file to say "Run" or "Stop" along with a few parameter values. I could setup a schedule to run daily and if the status changes to "Run" then the job runs for day/s until the text file is updated to say "Stop".
You can create and extremely simple small desktop for the user, where they can start Run/ Stop the job (simple C#, connect to database and execute job with the name of the job).
You can create a power shell script which will look for a file (text file) and depending on the value will run/stop the job.
I am using Splunk community edition for a monitoring dashboard.
I display a page of real time charts, I refresh the browser every now and then via a script.
This all works well however I am looking for a way to finalize and delete jobs running in the background as there is a limit as to how many live charts one can display in the community edition and when it refreshes the browser it seems to run to the limit after a while.
Thus how can I schedule the finalizing and deleting of the old jobs? (possibly a file I can remove from time to time)
I've overcame it by putting this at the top of my dashboard view (surrounded by XML tags):
< view autoCancelInterval="5" template="dashboard.html" >
The auto-cancel interval is set to 5 seconds. This means that when the search becomes inactive for 5 seconds or more, it will automatically cancel the search from running.
I have a cron job creating dynamic files and sending emails to system users. I need to set the language within the cron job so gettext and date formats work when creating the dynamic emails.
I cannot set the LANG in the /etc/environment file because the language is not static. Lets say the cron sends 10 different emails to 10 users - each could have a different language.
When I run my script in a webpage where I can set the session variables with
putenv("LC_ALL".LANG);
setlocale(LC_ALL,LANG.".utf8");
Everything works great. I am guessing since the cron doesn't create a session, these are ineffective.
Any ideas on how I can set this variable dynamically within a cron?
Figured it out. I forgot to bindtextdomain. It is something that is automatically done on the website but I added it to the cron script and all is well.
I have a question about p4 submit.
At work I have created a branch in perforce, and branched out from a main codeline(mainline) and got the latest revisions of all the files of a certain folder say folder1, from the depot into my workspace.
Now I changed a file inside folder1, say file.cpp. So I first Checked out that file from that branch into my workspace.
Now I wanted to submit this version to depot as next revision in the branch codeline (Not mainline - NO Integration intended, just want to create next revision of that file in my branch and submit to depot)
I use p4 visual client. When I right click on this changed file, file.cpp and say submit that file alone, it gave mer error:
verify job validation failed: MISSING JOB.
Job needs to be associated with change.
Question: How does one create this association between job and change.
What is to be done to fix this error and submit my file to create its next revision in the branch?
Well after another agonising trial and errors, found what i was doing wrong:
After we say file.cpp context Right Click, Submit, One has to create a new job.
In the window that comes up, enter description of job , username. When job is created successfully. it would say something like job5436060
Then control comes back to previous iwndow submit file. There add this job.
Earlier I was adding just the numerical part of job i.e. 5436060 , which lead to errors of job not found and it threw me offtrack completely.
What we need to enter while adding a job is job5436060 Now it will find the job, add successfully that job and then the submit command was successfull.
:-) Little joys you have, after anguishing over something you think should be straightforward but struggle after you miss something simple but fundamental.
Your perforce server must have a pre-submit trigger set up which requires a job with every submitted changeset. You'll have to (create and) add a job to the pending changeset before you submit it successfully.