Cron job setup in specific time - cron

I am using shared hosting cpanel my server timezone UTC format.
Every minute cron job is working fine.
Minute Hour Day Month Weekday Command
* * * * *
But when I am trying to Once per day it's not working.
15 21 * * *
in the above settings, it should run at 09:15 pm but it's not working.

verify your local timezone and server timezone are same or different.
in cronjob set the time by server timezone....
may be

Related

It's possible to add conditions in -ttl of Velero backup?

it's possible to add conditions in -ttl of Velero backup (backup from kubernetes clusters). For example: I have a schedule that makes backups everyday at 15:00, the -ttl of this backups is 72 hours, so in 72 hours, this backup will be deleted. Which is the problem? The problem is if the cluster is not up for 3 days, the backups will be deleted after it turns on, and there are will not be any backup left. I need to create a backup with -ttl 72 hours only if there are 3 backups or more in the blob storage. It's possible with Velero?
please use this below command has been used 72hrs backup only.
velero create schedule newschedule --schedule="*/5 * * * *" --snapshot-volumes --include-namespaces=default --volume-snapshot-locations=<SNAPSHOT_LOCATION>
To check this command:
velero schedule get
Make sure snapshot location must be same example/06-local-volumesnapshotlocation.yaml.
Sample output of the above command :
NAME STATUS CREATED SCHEDULE BACKUP TTL LAST BACKUP SELECTOR
newschedule Enabled 2022-06-30 15:15:39 +0530 IST */5 * * * * 720h0m0s 5m ago <none>
For your Reference :
openebs/velero-plugin
Back Up and Restore a Kubernetes Cluster Using Velero
you can go ahead and create a schedule.
Setting up the schedule
"Back up my cluster every day at 7 am"
velero schedule create every-day-at-7 --schedule "0 7 * * *"

How to configure azure webjob to run every 30 seconds

This should be quick - I know how to run .net webjobs down to every minute..
eg 0 0/1 * 1/1 * *
but I would like to run every 10 seconds!! I can find unix methods, but no azure webjobs / ,net examples..
To schedule a triggered WebJob you need to add a schedule property to the settings.job file. The value of the schedule is cron expression that has 6 fields to represent the schedule: {second} {minute} {hour} {day} {month} {day of the week}.
So you just add the following to a settings.job file if you want to run every 10 seconds.
{
"schedule": "*/10 * * * * *"
}
If your app runs continuous or scheduled WebJobs, enable Always On to ensure that the WebJobs run reliably. This feature is available only in the Basic, Standard, and Premium pricing tiers.
For more details, you could refer to this article.
the patterns seems to be like Cron schedule jobs
*/10 * * * *
https://crontab.guru

Cron job scheduled not running automatically in Node.js BOT

I am working on a Bot, using BotFramework-node.js hosted on Azure.
I am using four cronjobs in my bot to run different functions at different points of a day. The only issue is that the jobs are not running automatically. They will run normally if i compile/run the code, but wont if i don't compile/run it within 12 hours i.e, if i run the code manually today morning, the jobs will execute fine for today but tomorrow it won't unless i run it again.
Tried changing the modules. I have tried using node-schedule, node-cron. Now using cron
var Name = new CronJob({
cronTime:'0 15 11 * * 0-6',
onTick: function(){
//function call / another js file call
}
});
Name.start();

Is it possible to run a node.js app in Heroku every *4 minutes*?

I have an app I want to run in Heroku (the free version) every 4 minutes from like 10am-10pm Monday-Friday. I used to do this using a cron job in Digital Ocean but I'm trying to migrate over to Heroku since it's free. But is this even possible? From everything I can see it looks like you can only run stuff every 10 minutes on Heroku.
It is a simple app that sends email updates every 4 minutes.
Thank you.
Heroku doesn't give you a way to run things every 4 minutes. As you mentioned, the lowest the Scheduler add-on will give you is 10 minutes.
You could setup a process running all the time, and enqueuing/processing your tasks every 4 minutes though.
As mentioned in garson's comment, node-cron can handle this very easily for you.
For example, the following code:
var CronJob = require('cron').CronJob;
new CronJob('* */4 * * * *', function() {
console.log('You will see this message every 4 minute');
}, null, true, 'America/Los_Angeles');
Will show the console message every 4 minutes.
You can run it with node index.js.
So if you put the following line in your Procfile with the name cron and deploy your app, you can do:
heroku ps:scale cron=1
And the process will indefinitely, executing your code every 4 minutes.

Setting up cron job with Bolt on Plesk 11.5.30

I'm trying to setup a cron job with Bolt.cm via the Plesk 11.5.30 admin console.
Bolt task scheduler documentation: https://docs.bolt.cm/v20/tasks
Scheduled Tasks
I have setup crontab for the apache user as follows:
Min H DM M DW Command
0 */1 * * * /var/www/vhosts/mysite.com/httpdocs/app/nut cron
0 */1 * * * httpdocs/app/nut cron
The reason for two different commands here is that I've read in another thread troubleshooting Plesk that the command path should be relative from the domain. I assume if the first one fails, the second will still run. I also assume the above will run cron every hour.
Bolt Config
In my config file the cron_hour is set to 3am. However as the listener is set for an hourly event CRON_HOURLY I assume the setting is bypassed/ignored. Either way this setup has been running for over 48 hours and no effect has yet been witnessed.
Bolt Setup
As a test I have added the following into my Bolt extension so that it should simply send me an email when it is run (the following has been cut down to keep it short).
use \Bolt\CronEvents;
class Extension extends \Bolt\BaseExtension
{
function initialize() {
$this->app['dispatcher']->addListener(CronEvents::CRON_HOURLY, array($this, 'cronNotifier'));
}
function cronNotifier() {
// send email script...
}
}
I've tested my email script individual so I know it works. With the cron job setup and assumed to be running this function is never hit. What's more is that in the database the bolt_cron table remains to be empty.
If anyone could help suggest some things I could try to get this running it would be greatly appreciated.
THE FIX
In order to fix this issue I altered my schedule to execute every 5 minutes (quicker debug loop). I then made the following discoveries:
I had to set execute permissions on public for the nut file (so apache user could execute it)
for the server I'm using only the full path version works
Thanks #Gawain for prompting me in the right direction.
Scheduled Tasks
Yes, that looks correct. The handling of directory locations was enhanced recently, but you used to need to call nut from in the Bolt directory.
Bolt Config
cron_hour only applies to daily, and longer periods. There was a bug I fixed recently that was blocking out midnight to 3 am hourly tasks.
OK, there should be traces logged in the Bolt log about running cron events.
If you run this, do you see the hourly job trigger and your email sent?
./app/nut cron --run=cron.Hourly
If that works, then the problem is with the system cron/crontab, if editing directly were you using crontab -e?
Also if you're on an older checkout of master, you can try to prefix the crontab command section with
cd /var/www/vhosts/mysite.com/httpdocs &&
...before each invocation of ./app/nut

Resources