magento2 – Magento crontab vs Magento Cron (Scheduled Tasks)

I am working with the Magento2 Cron functionality, I have created a cron in the crontab.xml (Every 5 mins) default group

<job instance="NamespaceModuleNameCronServiceOrdersStatusUpdate" method="execute" name="ns_cron_status_update_for_service_orders">
   <config_path>*/5 * * * *</config_path>
        </job>

After that I noticed in admin system->config->system->Cron (Scheduled Tasks). there has some setting (Cron configuration options for group: default).

So when the cron will be execute what is the difference of the both.

Also I’ve created a command line for my cronfile, and added that into Magento crontab as follows

* */2 * * * php /var/www/html/bin/magento  service-order:status-update
#~ MAGENTO START 69dd2b02e1f3a65918182048ea4e29979a849d8942e8f53ed20a4bf10e529b36
#* * * * * /usr/bin/php /var/www/html/bin/magento cron:run 2>&1 | grep -v "Ran jobs by schedule" >> /var/www/html/var/log/cron/magento.cron.log
#* * * * * /usr/bin/php /var/www/html/update/cron.php >> /var/www/html/var/log/cron/update.cron.log
#* * * * * /usr/bin/php /var/www/html/bin/magento setup:cron:run >> /var/www/html/var/log/cron/setup.cron.log
#~ MAGENTO END 69dd2b02e1f3a65918182048ea4e29979a849d8942e8f53ed20a4bf10e529b36

If i am adding the my cron in the crontab, do i need to keep that cron in crontab.xml ?

magento2 – How to avoid to have many missed and pending cron jobs?

This is happening for two possible reasons:

  • Low server capacity by the number of cron jobs.
  • Not ideal prioritization.

You can solve that by changing the time that Magento takes to schedule the next job, and increasing the Missed if Not Run Within time, in case it’s an essential CRON job you can add it to a separate process, if it’s not essential you can add many minutes to it.

Magento 2 Cron Scheduled Tasks

Don’t forget to clean up your cache schedule by running these commands below.

n98-magerun2.phar db:query "DELETE from cron_schedule WHERE status='error' OR status='pending' OR status='missed'";
rm -rf var/cron/*
bin/magento cron:run

More details about the Cron (Scheduled Tasks) in the admin panel.

python – Cron email-deleter – Code Review Stack Exchange

I made this small program which takes some inputs (emails) and after looking if they exist it looks for the respective id and delete it. It works (I use it with crontab) but seems redundant. I had several problems with split and decode function, mainly because decode gives me lists of strings spaced by a tab. I would like to optimize the code and get rid of all these for loops, because the code seems long and sloppy. Any tips?

bastards = (
"team@mail.kamernet.nl",
"supportdesk@kamernet.nl",
"noreply@pararius.nl",
)

with imaplib.IMAP4_SSL(host='imap.gmail.com',port=993) as imap:
    imap.login(email,password)
    imap.select('INBOX',readonly=False)
    listy = ()
    for bastard in bastards:
        resp_code, respy = imap.search(None, f'FROM {bastard}')
        respy = respy(0).decode().split()
        listy.append(respy)
    listy = (x for x in listy if x)
    for i in listy:
        for j in i:
            imap.store(j,'+FLAGS','\Deleted')
            print('email_deleted')
    imap.expunge()
    imap.close()
    imap.logout()

WordPress cron not getting executed when called by external service (but ok from browser)

I’m trying to set up an external cron service to run cron in my WP site.

I have disabled WP’s own cron using define('DISABLE_WP_CRON', true); in wp-config.php.

As for the URL to call from the external cron service, I’ve tried with:

https://example.com/wp-cron.php
https://example.com/wp-cron.php?doing_wp_cron

But cron isn’t executed (I have a custom conr job set up to test this). I’ve tried several services, they all return HTTP code 200 so the calls to wp-cron.php are working, but looks like the hooks associated to cron aren’t.

I’ve installed a plugin (WP Control) to check all the active cron jobs and all other actions aren’t getting called either when using the external service.

However, if I manually call https://example.com/wp-cron.php by navigating to it from an internet browser, then cron gets executed fine.

I must be missing something here but can’t figure out what it is, any help would be much appreciated.

EDIT:

Forgot to mention that the external service calls the cron URLs every minute, and the cron job I have set up for testing as well. But all the other cron jobs that run at different intervals have issues when calling cron from external service.

8 – Timeout in sites, perhaps related to cron

8 – Timeout in sites, perhaps related to cron – Drupal Answers

docker – How can I configure cron startup on a new image without harming the Apache service?

I’m creating a new image with cron which is based on the php:7.3-apache-buster image.

The build of the image goes without a hitch. The container is also created with a status of Up. However, in the browser when I type http://localhost:8082 no Apache page is shown. The Apache service is inherited from the php:7.3-apache-buster image.

In my Dockerfile the last line is CMD cron && tail -f /var/log/cron.log. I believe it is this line that generates the problem.

What am I not understanding?

How can I build an image where the Apache from the base image and the Cron from the new image work together?

My references:

https://github.com/Ekito/docker-cron/blob/master/Dockerfile

https://hub.docker.com/_/php

cron – Reindexing through phpmyadmin has no effect

Using Magento version 2.2.2.

I have an issue where a product’s price in the search view differs from its price on the product page. The product hasn’t been on sale recently, so I think it’s a reindexing issue.

I went to System -> Tools -> Index Management. It said that Product Flat Data, Product EAV, and Catalog Search all needed reindexing.

When I selected those and set them to either Update by Schedule or Update on Save, the “Updated” date changed to the current time, but it still said “Reindex Required.”

(I have an error at the top of my dashboard that says “One or more indexers are invalid. Make sure your Magento cron job is running.” That’s probably related).

Attempted fixes: I flushed the Magento cache immediately before and immediately after reindexing. And when I set it to “Update on Save,” I added a new product to try and trigger the reindexing.

What do I do to reindex these things properly?

unix – Question regarding the execution of reverse shells in cron

I have some doubts as to how cron executes commands and its output. Suppose I have the following cronjob:

*/5 * * * * root /home/user/shell.sh.

shell.sh:

#!/bin/bash
echo "hello"
bash -i

What I want to know is how cronjob executes the above script. Will the bash -i process be running in the background after the execution of the script? If so where can I access this bash shell?

Secondly, suppose, I have started a nc -lvnp 8000 on my computer(A) and I have placed a reverse shell in the cronjob script, shell.sh, which is in computer(B). What happens when the script runs?

Will I receive a connection that ends as soon as the script ends? Or will the script continue to run as long as the connection is up? If so what happens after 5 mins when cronjob needs to run the shell.sh again? Will I get a second connection?

postgresql – Supabase postgres cron job not working special case

I’m having the problem! while insering a row using rpc through the nodejs library! with user service_role!

i gave permission to all roles! Without exception!

And for service_role i even gave it all priveleges in the whole database just for the sake of testing!

launching the cron from the dashboard editor! And after giving the permission to postgres as above! And as per this thread
It worked! The cron worked just right!

But then when i do it through service_role! From nodejs rpc insert! Which trigger a trigger procedure! Which run all right!

i made a command to ccheck which insert in a log table i created! In mean time! the job is added to the jobs table! And being active!

However no command run! (the mentioned user i gave him the privleeges for cron! But then after i gave him even access to all! Nothing works!

Any ideas or pointing!

Here my trigger function

image

The schedule command is temporal i took from the one that worked on the dashboard to make sure !!?

How can this be explained ? Any ideas or points ? Anything may be special about supabase ? May be the service_role user have some restriction ??? or ! i’m just out of clues hhh

( an official ref: https://supabase.io/blog/2021/03/05/postgres-as-a-cron-server )

DreamProxies - Cheapest USA Elite Private Proxies 100 Cheapest USA Private Proxies Buy 200 Cheap USA Private Proxies 400 Best Private Proxies Cheap 1000 USA Private Proxies 2000 USA Private Proxies 5000 Cheap USA Private Proxies ExtraProxies.com - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive.com Proxies-free.com New Proxy Lists Every Day Proxies123.com Proxyti.com Buy Quality Private Proxies