Geting bundle product price by product id this code working without cron but in cron doesn’t work Magento2

This code work without cron, but in cron doesn’t work it’s returning Zero(0)
Also check cron is executing successfully.

$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$product = $objectManager->create('MagentoCatalogModelProduct')->load($product_id);
if ($product->getTypeId() == 'bundle') {
  $regularPrice = $product->getPriceInfo()->getPrice('regular_price')->getMinimalPrice()- 
>getValue();
  $specialPrice = $product->getPriceInfo()->getPrice('final_price')->getMinimalPrice()- 
>getValue();            
}

Here product_id is your product Id.

bash – incrontab is not triggering with end of cron sh invokes

I have this incrontab, which is monitoring the master Directory to check if the event occurs where a new file is placed here … and run the php file.

/var/www/html/docs/int/master IN_MOVE php /var/www/html/shscript/work.php

I have a crontab that runs every one minute, and invokes the execution of a .sh file, the content of this SH is to copy the txt files to the Master directory that is in the previous incrontab (that work well):

cd /mnt/test1/int/master
cp *.txt /var/www/html/docs/int/master

The probllem:

when the cron is end of run (copy is successfull), but the icron is not triggering, no detecting event like: IN_MOVE, IN_MOVED_TO; but if i change the event to: IN_MODIFY ; Work well and execute the php file; but i not need to run the php file on modify event i need run it if the file is succefull copy.
I do not know what I’m doing wrong.

wp cron – wp_cron schedule event fails to execute

I am attempting to schedule a event in wordpress, but it never seems to execute.

Here is my test code.

add_action( 'run_my_test', 'my_test_function', 10);
function my_test_function() {
    file_put_contents("test.log", "run eventn", FILE_APPEND);
}

if (!wp_next_scheduled('run_my_test')) {
    $zone = new DateTimeZone('America/New_York');
    $next = new DateTime("20:38:00", $zone);
    wp_schedule_single_event($next->format('U'), 'run_my_test');
    file_put_contents("test.log",'scheduled event', FILE_APPEND);
}

It creates the event, but never executes and then it wont recreate the event, even if I change the time. I have to unscheduled the event in order to test it again.

catalina – Granting cron permission to control Finder

I aim to use cron to call a python script that changes my desktop background. The key python line is as follows:

from appscript import mactypes, app
app('Finder').desktop_picture.set(mactypes.File(chosen_pic))

When running said script from Terminal, the program runs, but when called by cron, this line gives an error that appears via mail. Experimentation yielded that running from Terminal gives the same error when its permission to edit Finder is unchecked here:

enter image description here

It seems likely that if I could give cron permission to control Finder in this way, that’d solve the problem, but cron’s not on this list, and I don’t see a way to add it. By contrast, the Full Disk Access pane lets one add new programs, but adding cron doesn’t solve this. If it helps, this is on Catalina 10.15.5.

How can one add a new app to the Automation pane here and give it permission to control another app?

Thank you!

wp cron – Error trying to publish immediately. Post status = future (Missed schedule error)

We have moved a to new server and now we can’t publish. At least, we can’t publish instantly.

Maybe can be useful: we are using Plesk & CloudFlare.

When we publish a new post, the post_status value in wp_posts table is, automatically, future instead of publish

We have already taken a look at this post with no lucky:
https://wordpress.org/support/topic/publish-immediately-missing-and-scheduled-posts-fails/

What we have already done is:

  • Checked server time
  • Everything OK into site health info
  • Disabled all plugins & changed to default theme
  • Disabled WP Cron and setted custom cron
  • Installed My Missed Schedule and WP Control plugins
    (thanks to the first one, a cron event that is running each 5 minutes forces to publish missed scheduled post).
  • Installed wp-cli and trying to run with wp cron event run publish_future_post --due-now with no lucky
  • Checked PHP extensions according to this
  • An exact backup in my localhost is working like a charm

Here are some snapshots when trying to publish a post at 12:57pm…
Missed schedule

And here the cron thas is created just after trying to publish:
cron list

This is how post_date & post_date_gmt looks on the database:
post date

And this is how the time looks in WP:
wordpress time

So, until 2 hours later, the post isn’t published…
This is being a nightmare. We can’t use, for example, the ACF plugin. We add a new field, and it doesn’t appear until 2 hours later…

Any clue?

centos – Linux maldetect email notifications for daily cron scans no longer working

As many know LMD only sends an email notification when there’s a hit during the daily (cron) scan or if you manually trigger maldetect from the command line. The workaround on this topic How to get an email report of whatever the most recent maldet scan is? provided a great solution so all daily scheduled scan reports were email. Up until a few weeks ago this stopped working and instead the email notification shows this error:

Here are the results of the latest LMD scan:

{cron} unable to find /usr/local/maldetect/sess/session.last.

Email provided by LMD Cron Email v1.0.0
Cron file: /usr/local/maldetect/cron/custom.cron
Log file: /usr/local/maldetect/logs/event_log

Any suggestions? Why is session.last not visible? I can see in the event_log that LMD is running scans throughout the day just fine as noted below in the log:

Jul 16 12:11:49 server maldet(31941): {mon} scanned 2 new/changed files with clamav engine
Jul 16 12:13:49 server maldet(31941): {mon} warning clamd service not running; force-set monitor mode file scanning to every 120s

Current system: CentOS 7.8 v.86.0.18.

Cronjob stopped working. But cron and php script still work?

I did a ImageMagick install on my CentOS webserver and afterwards my cronjobs do not work anymore.

I have cronjobs that executes php files. For example one cronjob execute every 15 minutes a php file that reads a json file and insert variables in my mysql database. I did not change the php files and they still work from the command line with php -q /home/admin/domains/domain.nl/public_html/command/myfile.php

The status of my cron is:

(admin@server domains)$ service crond status
Redirecting to /bin/systemctl status crond.service
● crond.service - Command Scheduler
   Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2020-07-10 22:52:30 CEST; 10h ago
 Main PID: 13519 (crond)
   CGroup: /system.slice/crond.service
           └─13519 /usr/sbin/crond -n

I have tried to restart my server, I have restart my cron service without result.

My /var/log/cron looks like

Jul 11 09:13:01 server CROND(11480): (root) CMD (/usr/local/directadmin/dataskq)
Jul 11 09:14:01 server CROND(11629): (root) CMD (/usr/local/directadmin/dataskq)
Jul 11 09:15:01 server CROND(11792): (root) CMD (/usr/local/directadmin/dataskq)
Jul 11 09:15:01 server CROND(11791): (admin) CMD (php -q /home/admin/domains/domain.nl/public_html/command/myfile.php)
Jul 11 09:16:01 server CROND(11931): (root) CMD (/usr/local/directadmin/dataskq)
Jul 11 09:17:01 server CROND(12075): (root) CMD (/usr/local/directadmin/dataskq)
Jul 11 09:18:01 server CROND(12244): (root) CMD (/usr/local/directadmin/dataskq)
Jul 11 09:19:01 server CROND(12375): (root) CMD (/usr/local/directadmin/dataskq)
Jul 11 09:19:43 server crontab(13932): (root) LIST (admin)
Jul 11 09:20:01 server CROND(13993): (root) CMD (/usr/lib64/sa/sa1 1 1)
Jul 11 09:20:01 server CROND(13994): (root) CMD (/usr/local/directadmin/dataskq)
Jul 11 09:21:01 server CROND(14168): (root) CMD (/usr/local/directadmin/dataskq)

With

php -q /home/admin/domains/domain.nl/public_html/command/myfile.php
2>&1 >>php -q
/home/admin/domains/domain.nl/public_html/command/errorlog.txt

I try to view an extra error log, but the output to errorlog.txt is empty (but the file is made!).

So I do not understand why the php file is doing nothing? What steps can I do to find the problem with the cronjob?

Installing imageMagick was not easy. I also used the command: mount -o remount,exec /tmp

installing – Ultimate Cron installation Table ‘db_name.ultimate_cron_log’ doesn’t exist

After installing the ultimate cron module version 8.x-2.0-alpha4,
When I navigate to (/admin/config/system/cron/jobs), I get the following error meassage –

Base table or view not found: 1146 Table ‘db_name.ultimate_cron_log’ doesn’t exist: SELECT l. FROM {ultimate_cron_log}* l WHERE (l.name = :db_condition_placeholder_0) AND (l.log_type IN (:db_condition_placeholder_1)) ORDER BY l.start_time DESC, l.end_time DESC LIMIT 1 OFFSET 0; Array ( (:db_condition_placeholder_0) => system_cron (:db_condition_placeholder_1) => 0 ) in Drupalultimate_cronEntityCronJob->loadLatestLogEntry() (line 526 of modulesultimate_cronsrcEntityCronJob.php).
DrupalCoreDatabaseStatement->execute(Array, Array) (Line: 640)

I have tried uninstalling and installing it again, but the error persists.
Kindly help.

apache2 – Issue restarting apache with cron / crontab ( Ubuntu 18.04)

I have a specific case where testing a new version of the software is being done at a specific time of the day so I have cronjob that should:

Software is set in /var/www/html folders V2 and V3 respectively. Therefore I use sed to change the version. a] in the morning change virtual host and restart apache b] in the afternoon change back to an old version and restart apache

Crontab is set like this:

0 9 * * *  sed -i 's/V2/V3/g'  /etc/apache2/sites-available/software.conf && service apache2 restart
0 14 * * *  sed -i 's/V3/V2/g'  /etc/apache2/sites-available/software.conf && service apache2 restart 

Sed changes the version but apache doesn’t restart to apply the changes. Can you please help me fix the issue? Thanks