cron-task

CRON - chown and chgrp to a directory from root user to www-data

这一生的挚爱 提交于 2019-12-11 10:02:02
问题 I am trying to change group and owner (from root to www-data) for a directory. So I have set a cron on root which looks like this: 0,5 * * * * sudo /bin/chown -R www-data /var/www/pdf/ && sudo /bin/chgrp -R www-data /var/www/pdf/ But unfortunately it's not working. Can anyone please help me? 回答1: 0,5 * * * * sudo /bin/chown -R www-data /var/www/pdf/ && sudo /bin/chgrp -R www-data /var/www/pdf/ First off, the chgrp is redundant, you can manage the same with the chown command itself. So instead

How dynamically set variables on Cron?

假装没事ソ 提交于 2019-12-11 06:59:44
问题 I'm trying to make a cron file to be placed in /etc/croon. d. My problem is I don't want keep this file updated, so I'm looking for a way to get the software version dynamically from a file. I have few other variables, but for now I think the problem is with $ (cat /software/VERSION) , it works very well in shell script but not on croon. #!/bin/bash SHELL=/bin/bash PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin APPLICATION_ENVIRONMENT=SOME_STRING VERSION=$(cat /software

MySQL - Change field value after X minutes of inactivity

旧城冷巷雨未停 提交于 2019-12-11 03:37:18
问题 I am trying to find a way to have a cronjob which checks how long it has passed since the last update of a row, if it is more than X, then change field 'ACTIVE' to 'FALSE'. I have a robot which updates its current IP and add the timestamp. From the other side, there might be a User willing to send commands to the robot. My idea is to be able to tell whether the robot has been active in the last X seconds and therefore it makes sense trying to send a command to it. So, I guess some sort of

Does cron job block the main process or nodejs will create a worker to do cron task

烈酒焚心 提交于 2019-12-11 02:39:42
问题 I am using node-cron to do some heavy tasks (update database) every minute. Does this task use main process to work or nodejs will create some workers to do these taks? var CronJob = require('cron').CronJob; new CronJob('0 * * * * *', function() { //Update database every minute here console.log('Update database every minute'); }, null, true, 'America/Los_Angeles'); 回答1: It is supposed to create a worker for you.. It is not well documented in the library docs but: 1) You can see at the

run cron job on end of every month

南楼画角 提交于 2019-12-10 23:13:56
问题 I need to run a script at 2 pm on the end of every month. The reason i set 2 pm is i've a timezone of asia/calcutta and it differs 10 hrs and 30 min. from the server time. I've set date_default_timezone_set('Asia/Calcutta') in my script, so for the current settings i can trigger 1st day of every month as per my timezone. But the issue is, i'm using webmin and there is no settings to run end of every month and only date from 1 - 31 listed. Here i attached the screenshot. How can i run the

Getting cron job error because of <?php tag

不打扰是莪最后的温柔 提交于 2019-12-09 18:48:10
问题 I've set up a cron job to run. It executes a php file which is named cronj.php But it doesn't work and cron job notification I get is: /root/website/myworld/blabla/cronj.php: line 1: ?php: No such file or directory And line 1 in that file is simply a php tag <?php I don't know how 回答1: Cron is executing the file as if it was a shell script. Normally you would put in a shebang line (like #!/usr/bin/env php ) at the top of the file so that the shell knows how to invoke it, but PHP doesn't like

How to set a Cron job in Every one hour from 9:00 am to 6:00 pm ( Monday to Friday )

孤者浪人 提交于 2019-12-08 13:57:56
问题 How to set a Cron job in Every one hour from 9:00 am to 6:00 pm ( Monday to Friday) I am using Hostgator cron job to send mail every one hour, Now I want it from Monday to Friday. below is the link to screen shot. http://awesomescreenshot.com/0123cmfxe1 Please help me. 回答1: This should work: 0 9-18 * * 1-5 /path_to_script EDIT: In the format of the boxes it would be 0 9-18 * * 1-5 来源: https://stackoverflow.com/questions/25424102/how-to-set-a-cron-job-in-every-one-hour-from-900-am-to-600-pm

Google Cloud Function - AttributeError: 'module' object has no attribute 'DEFAULT_MAX_REDIRECTS'

雨燕双飞 提交于 2019-12-07 12:06:50
问题 I'm using Appengine cron job to schedule cloud function and when I deploy and try to run a job, getting below error. Any idea what could be wrong here? Followed steps from [here][1] (/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/1/google/appengine/runtime/wsgi.py:263) Traceback (most recent call last): File "/base/alloc/tmpfs/dynamic_runtimes/python27/a7637d5531ec9deb_unzipped/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 240, in

wordpress schedule event not firing in set time

独自空忆成欢 提交于 2019-12-07 06:15:17
问题 In WordPress I am creating a plugin where I am sending email to users. For that I am using WordPress cron job. So basically what it will do is just send emails to users in every hour. So my code looks like this public function __construct() { add_action('init', array( $this, 'send_emails_to_users') ); add_action('cliv_recurring_cron_job', array( $this, 'send_email') ); } public function send_emails_to_users() { if(!wp_next_scheduled('cliv_recurring_cron_job')) { wp_schedule_event (time(),

How to work with cron job in zendframework 2? [duplicate]

我与影子孤独终老i 提交于 2019-12-06 14:29:13
问题 This question already has answers here : How to run cron job with zend framework 2 (2 answers) Closed 6 years ago . I have two functions in zend framework 2, which fetch me the details of apartments from another site and save them in my data base. (BUT THEY DO SO ONLY WHEN I RUN THE FUNCTIONS). say the controller name is 'FetchFromSourceController' and the functions are 'index' and 'ical'. those are the names I used. But my requirement is those two functions should run automatically one after