cron

How to set up cron to run once a day at random times

ぐ巨炮叔叔 提交于 2021-01-27 07:12:38
问题 Hi so right now I have a basic cron that runs my stuff twice a day at 1 and 6. Something like: H 1,18 * * * The problem is I have like 100 things kicking off at this time which is clogging up my machine. I want to randomly generate a time once a day for each job to run. It's ok if 5-7 are going at once. So I guess my question is. For one is this possible? If so is there a best practice for this? I'm loading everything up in groovy so I was just thinking about generating a number between 1-24

Laravel Scheduling Task on AWS is not working

ⅰ亾dé卋堺 提交于 2021-01-27 06:41:22
问题 I am deploying my Laravel application to ElasticBeanstalk environment. I am trying to run a command in the Scheduling Task on the server. But it is not working. This is what I have done. I schedule my command in the Kernel.php file as follow. $schedule->command('counter:update')->everyMinute()->onOneServer(); I am using Redis as my cache driver and it is working. Then I tried two different approaches. First Approach: Using Laravel AWS Worker package , https://packagist.org/packages/dusterio

Laravel Scheduling Task on AWS is not working

╄→尐↘猪︶ㄣ 提交于 2021-01-27 06:40:19
问题 I am deploying my Laravel application to ElasticBeanstalk environment. I am trying to run a command in the Scheduling Task on the server. But it is not working. This is what I have done. I schedule my command in the Kernel.php file as follow. $schedule->command('counter:update')->everyMinute()->onOneServer(); I am using Redis as my cache driver and it is working. Then I tried two different approaches. First Approach: Using Laravel AWS Worker package , https://packagist.org/packages/dusterio

Where is the STDOUT and STDERR output of a crontab job

笑着哭i 提交于 2021-01-27 04:55:15
问题 Does any body know where is the STDOUT and STDERR of a normal crontab job output in CentOS? I checked the /var/log/cron file, but it only record the time and command of a cron job executed, no STDOUT or STDERR content found there. 回答1: Have a look on /etc/rsyslog.d/ there you should can change loglevel of cron . #cron.* /var/log/cron.log removing the # = maximum logging cron.err /var/log/cron.log only error log 来源: https://stackoverflow.com/questions/28067714/where-is-the-stdout-and-stderr

here() issue in R scripts

落花浮王杯 提交于 2021-01-26 07:34:40
问题 Here issue in R scripts I am trying to understand how would here() work in a portable way. Found it: See what works later under Final answer - TL;DR - the bottom line, here() is not really that useful running a script.R from commandline. The way I understand it with help from JBGruber: here() looks for the root directory of a project (e.g., an RStudio project, Git project or other project defined with a .here file) starting at the current working directory and moving up until it finds any

run “docker run” from crontab

£可爱£侵袭症+ 提交于 2021-01-26 03:59:25
问题 I try to make automated (every night at 4) backups from a postgresql database running inside a docker container. #!/bin/sh CONTAINER=`docker ps|grep name_of_container|awk '{print $1}'` USER='postgre_user' PASSWORD='changed' BUDIR='/some/path/backup/' docker run -it --link $CONTAINER:db -v $BUDIR:/backup/ -e "PGPASSWORD=$PASSWORD" pg_dump -h db -U $USER -Fc -f /backup/$(date +%Y-%m-%d-%H-%M-%S).dump My crontab looks like this: 0 4 * * * /path/to/script.sh The script works fine when I execute

run “docker run” from crontab

邮差的信 提交于 2021-01-26 03:58:03
问题 I try to make automated (every night at 4) backups from a postgresql database running inside a docker container. #!/bin/sh CONTAINER=`docker ps|grep name_of_container|awk '{print $1}'` USER='postgre_user' PASSWORD='changed' BUDIR='/some/path/backup/' docker run -it --link $CONTAINER:db -v $BUDIR:/backup/ -e "PGPASSWORD=$PASSWORD" pg_dump -h db -U $USER -Fc -f /backup/$(date +%Y-%m-%d-%H-%M-%S).dump My crontab looks like this: 0 4 * * * /path/to/script.sh The script works fine when I execute

Laravel artisan cron not working

≯℡__Kan透↙ 提交于 2021-01-22 11:53:51
问题 I have got a page which queues up emails in beanstalked. The script works as intended, the emails get fired when i have a queue listener, ie. php artisan queue:listen But when i remove the listener and add it to the crob job * * * * * /usr/bin/php /var/www/huge/artisan queue:listen The emails don't get fired. Any ideas? 回答1: Had this exact same issue the other day, you probably just need to cd in to the directory where Artisan is located first. Try the following: * * * * * cd /var/www/huge/ &

node-cron with timezones

杀马特。学长 韩版系。学妹 提交于 2021-01-22 10:35:43
问题 i have a node(v0.7.3-pre) server with node-cron(0.3.2) and node-time(0.8.2): var cronJob = require('cron').CronJob; var cronJ = new cronJob({ cronTime: "00 29 16 6 * *", onTick: function() { console.log("Tick"); }, start:true, timeZone: "America/Los_Angeles" }); console.log(cronJ); it runs, but the Cron is allways working with the server time(UTC), and the returned cron is: { _callbacks: [ [Function] ], onComplete: undefined, cronTime: { source: '00 29 16 6 * *', zone: undefined, second: { '0

node-cron with timezones

末鹿安然 提交于 2021-01-22 10:33:28
问题 i have a node(v0.7.3-pre) server with node-cron(0.3.2) and node-time(0.8.2): var cronJob = require('cron').CronJob; var cronJ = new cronJob({ cronTime: "00 29 16 6 * *", onTick: function() { console.log("Tick"); }, start:true, timeZone: "America/Los_Angeles" }); console.log(cronJ); it runs, but the Cron is allways working with the server time(UTC), and the returned cron is: { _callbacks: [ [Function] ], onComplete: undefined, cronTime: { source: '00 29 16 6 * *', zone: undefined, second: { '0