How to set up a cron job for PHP on IIS? - iis

How would I go about setting up a PHP cron job in IIS?

Cron jobs are usually not executed via http servers, so use the Task Scheduler to execute the php interpreter and provide the physical path to your php script as a commandline argument.

Related

PM2 cron jobs list view

Good afternoon,
I started two cron jobs with pm2 and was wondering if there was a way to list the cron jobs.
Both of my cron jobs execute a shell script to start/stop a server.
Note: Also, is there a log of the cron jobs? Would I have to configure my own shell script to log it in a text file?
Thank you.

Magento 2.3: Cron job is only working when I run the cron command manually

I have created a cron job and its only working when I run the below command:
php bin/magento cron:run
But the cron should run automatically. What Could be the issue and why the cron is not running automatically in my case?
Could anyone please help me and guide on this?
Cronjobs in Magento are separate from the cronjobs ran on the server. A cronjob in Magento can't run without a cronjob on the server.
If you want cronjobs in Magento to run automatically you'll have to add a cronjob on the server.
* * * * * bin/magento cron:run
I do not recommend copy-pasting the above as a cronjob on your server, it does for example not log any output.
If you want a more detailed explanation about the workings of cronjobs in Magento I recommend the article in Magento DevDocs below.
https://devdocs.magento.com/guides/v2.4/config-guide/cli/config-cli-subcommands-cron.html

Running a node script 'forever' in heroku (or aws) with no front end?

I have a requirement of running a node script (not app or dapp), which has no front -end files (html, css). This script will send transactions (call smart contract function) in regular intervals. the only constraint is that this script needs to run perpetually (forever) without stopping, unless a specific command is given by admin. Please do suggest how we could achieve this? Thanks.
PS: in case you have a better platform suggestion other than heroku, those are welcome as well with details. Tx.
Unix cron works fine for this kind of things. Just add a cron in your crontab with command :
crontab -e
Then just set your pattern and add a line with your command to launch, for example this will run each day at 3.00 AM:
0 3 * * * /root/backup.sh
Then don't forget to reload your cron process:
sudo service cron restart
Define your pattern here : https://crontab.guru/
You can have a look at kue.
The good thing about kue is, that it gives you a UI where an admin can view the running, failed, jobs etc. Also, you can configure it to stop a job programmatically.

system cron not running intended process scheduled for execution

I have node server that I want to restart whenever it stopped. For this case I setup system cron on ubuntu server to execute a simple bash script that will track node server every minute and log the server status. Now this cron trigger this bash script and logs relevant status every minute but node server doesn't execute(Using simple linux command I can check if node server running or not). When manually running that bash script node server starts but something happening when cron executes that script. I am trying to fix this meanwhile any help will be appreciated.
Thanks
instead of doing this with cron i think you have to use spervisor in order to keep the process running check this supervisor website

Redhat openshift - Cron Runtime - Is there a default time for how long cron executes

Cron on Redhat openshift is cancelled by SIGTERM after some minutes.
Is there a default timeout on how long cron tasks can execute?
If yes, how to get long running tasks working?
Yes, There is apparently a default timeout of 5 min on top level script for cron tasks execution on Redhat openshift.
The solution is to use "nohup" to get long running tasks working.
For ex:
File .openshift/cron/minutely/task1 -
nohup /path-to/some-other-script > $OPENSHIFT_LOG_DIR/logfile 2>&1 &

Resources