trying to run custom cron in magento 2 giving below error in system.log file
main.WARNING: Could not acquire lock for cron group: default, skipping run [] []
Please check below code for custom cron
Create crontab.xml in app/code/Vendor/Module/etc/ folder
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Cron:etc/crontab.xsd">
<group id="default">
<job name="bestseller_cronjob" instance="Test\Customcron\Cron\Bestseller" method="execute">
<schedule>0 1 * * *</schedule>
</job>
</group>
</config>
And create on instance file for cron execute
app/code/Test/Customcron/Cron/Bestseller.php
<?php
namespace CP\Coreoverride\Cron;
use Magento\Framework\App\Bootstrap;
class Bestseller {
public function execute()
{
//your code goes here
}
}
You can execute cron by below command
php bin/magento cron:run (for all cron execute)
php bin/magento cron:run --group="bestseller_cronjob" (particular cron group)
Related
<?xml version="1.0" encoding="UTF-8"?>
<attributes>
<attribute name="priority" type="string"/>
<attribute name="hierarchy" type="script"path="$WORK_DIR/pvim2vmgr/python_script/hierarchy.py">
<scriptParam name="subject"/>
<scriptParam name="test_plan"/>
</attribute>
I'm expecting when I set environment cmd in xterm.
setenv WORK_DIR <my_path>
In xml script, it'll recognize my directory ($WORK_DIR).However, it doesn't, is there any cmd for me to implement it?
Purpose of using xml script
I'm using it to obtain information from certain website and generate a csv file. This xml script is running with command line argument.
Reason I want to replace Working directory
When I'm using other person working_dir to generate this xml script, it automatically replace the $WORK_DIR to other person instead of mine.
I'm facing issue with page layout in Magento 2.4.x
Right now I have created a test page in a test module.
Followed all necessary steps to show some text on the page with default theme. I see the output but with broken page layout.
I wonder what I did wrong in the process.
Please advice.
Module files as below
Route: Tadawi\Helloworld5\etc\frontend\routes.xml
<?xml version="1.0" encoding="UTF-8"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd">
<router id="standard">
<route id="helloworldroute" frontName="helloworld">
<module name="Tadawi_Helloworld5"/>
</route>
</router>
</config>
Controler: Tadawi\Helloworld5\Controller\Index\Index.php
<?php
namespace Tadawi\Helloworld5\Controller\Index;
use Magento\Framework\Controller\ResultFactory;
class Index extends \Magento\Framework\App\Action\Action
{
/** #var \Magento\Framework\View\Result\PageFactory */
protected $resultPageFactory;
public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\View\Result\PageFactory $resultPageFactory
) {
$this->resultPageFactory = $resultPageFactory;
parent::__construct($context);
}
public function execute()
{
$resultPage =$this->resultPageFactory->create();
return $resultPage;
}
}
Layout file :Tadawi\Helloworld5\view\frontend\layout\helloworldroute_index_index.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<referenceContainer name="content">
<block class="Tadawi\Helloworld5\Block\Index" name="helloworld.index" template="Tadawi_Helloworld5::index.phtml" />
</referenceContainer>
</page>
Template file : Tadawi\Helloworld5\view\frontend\templates\index.phtml
<h2>Hello World</h2>
<p>Hello and welcome!</p>
This is the output that I'm getting if I call the route
You need to add this file block file also that you mentioned in this.
Or You can simple add '\Magento\Framework\View\Element\Template' instead of class
Also try to run below command and then check
php bin/magento se:up
php bin/magento s:d:c
php bin/magento s:s:d -f
php bin/magento c:f
May be this will help you to solve your problem.
I'm using Thunar as file browser for a linux network composed of 100 CentOS 7.2 machines. We are managing the installation of those workstations with a PXE server and SaltStack installation.
I need to create those custom actions during the installation.
Currently, Thunar is installed on every workstations, the script is available on a share but I need to create the custom action on each machine. Open Thunar, Edit > Create custom actions and it launches my script in xterm for the selected folder:
xterm -e "/path/to/my/script.sh %f"
Is there a way to create Thunar's custom actions from command lines or by editing a file so that I will be able to launch them through Salt cmd.run?
Thanks for your help.
I've found out that those Custom actions are store in this file:
cat ~/.config/Thunar/uca.xml
Here is an example of the syntaxe:
<?xml encoding="UTF-8" version="1.0"?>
<actions>
<action>
<icon>script.png</icon>
<name>My custom action</name>
<unique-id>1479309009025049-2</unique-id>
<command>xterm -e "/path/to/my/script.sh %f"</command>
<patterns>*</patterns>
<startup-notify/>
<directories/>
<audio-files/>
<image-files/>
<other-files/>
<text-files/>
<video-files/>
</action>
</actions>
That way, I can create this template file and copy it in the user folder.
I'm testing the Jenkins jUnit plugin with a manual jUnit Xml file. And I get following info from console output
failed: Test reports were found but none of them are new. Did tests run?
I've searched the solution for this problem but none of them solve my confuse. I try to run a shell script. Since I'm pretty new to this(might have a lot of errors). Here is a piece of my shell script.
cd /Users/Shared/Jenkins/Home/jobs/jUnitReport
sudo visudo
Jenkins ALL = NOPASSWD: /bin/sh -xe /Users/Shared/Jenkins/tmp/hudson7751940722564747051.sh
touch jUnit.xml
I don't really know how to access Jenkins to touch the file.(one of the solution to "failed: Test reports were found but none of them are new. Did tests run?").
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="PerformanceTest" errors="0" skipped="0" tests="2" failures="1" time="10.74" timestamp="2016-05-24T10:23:58">
<testcase classname="PerformanceTest" name="testSmoothness" time="15" jank-percentage="75">
<failure message="Too many jank frames." />
</testcase>
<testcase classname="PerformanceTest" name="testResponseTime" time="1.3" response-time="0.3">
</testcase>
</testsuite>
</testsuites>
Any help will be appreciated.
Thank You!
(copied from my comment)
Source. There is a timestamp check but looks like it works on file timestamps (last modified) and uses a jitter of 3000 (presumably milliseconds). The JUnit plugin is ignoring test XML output that is older than the buildtime of the current build minus 3 seconds. If the test run and the JUnit plugin run are more than 3 seconds apart, the plugin will ignore the files.
we use hudson ci to trigger a build.xml which invoke a shell script in linux via Ant exec command.
From the console output shows the zookeeper successfully started
After checked the zookeeperPID,its valid after the zookeeper started.But just few seconds later,the process disappeared without any notes.
I have checked my build.xml ,shell script,os env and investigate the ant source code regarding exec task,but still not any clue.
The shell and build.xml can work smoothly by commands on linux but problematic by hudson job trigger.
Any help would be great appreciated!
build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="project" default="default">
<target name="default" description="description">
<exec executable="/bin/bash">
<arg value="test.sh"/>
</exec>
</target>
</project>
test.sh
#!/bin/bash
cd ${target_dir}/zookeeper-3.4.3/bin
sh zkServer.sh start
due to the hudson process handling,the spawning process will be killed which caused this issue.
RefUrlLink: https://wiki.jenkins-ci.org/display/JENKINS/ProcessTreeKiller
The work around is setting the java parameter to disable related class file
-Dhudson.util.ProcessTreeKiller.disable=true