crontab

php cron job every 10 minutes [closed]

耗尽温柔 提交于 2019-11-27 02:17:47
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . I'm trying to run a cron job so that a php script will run every 10 minutes on my server. The script updates a database. Right now my crontab looks like: * /10 * * * * /usr/bin/php /home/user/public_html/domain.com/private/update.php However, the php script never seems to run. I've also tried reloading cron

mysqldump doesn't work in crontab

亡梦爱人 提交于 2019-11-27 01:49:59
问题 I'm trying to add a cronjob in the crontab (ubuntu server) that backups the mysql db. Executing the script in the terminal as root works well, but inserted in the crontab nothing happens. I've tried to run it each minutes but no files appears in the folder /var/db_backups. (Other cronjobs work well) Here is the cronjob: * * * * * mysqldump -u root -pHERE THERE IS MY PASSWORD --all-databases | gzip > /var/db_backups/database_`date +%d%m%y`.sql.gz what can be the problem? 回答1: You need to

Validating Crontab Entries with PHP

删除回忆录丶 提交于 2019-11-27 01:10:32
What is the best way to validate a crontab entry with PHP? Should I be using a regex, or an external library? I've got a PHP script that adds/removes entries from a crontab file, but want to have some way to verify that the time interval portion is in a valid format. Hmmm, interesting problem. If you're going to really validate it, regex isn't going to be enough, you'll have to actually parse the entry and validate each of the scheduling bits. That's because each bit can be a number, a month/day of the week string, a range (2-7), a set (3, 4, Saturday), a Vixie cron-style shortcut (60/5) or

#研发中间件介绍#定时任务调度与管理JobCenter

会有一股神秘感。 提交于 2019-11-27 00:32:58
郑昀 最后更新于2014/11/11 关键词: 定时任务 、调度、监控报警、Job、crontab、Java 本文档适用人员:研发员工 没有JobCenter时我们要面对的: 电商业务链条很长,业务逻辑也较为复杂,需要成百上千种定时任务。窝窝的大多数定时任务其实调用的是本地或远端 Java/PHP/Python Web Service。如果没有一个统一的调度和报警,在集群环境下,我们会: 不知道哪一个定时任务执行失败或超时,不见得能第一时间知道——直到最终用户投诉反馈过来; 要求每一个定时任务输出统一格式的日志供监控系统解析? 对每一位定时任务维护者提出高要求?这不是我们的解题思路。 不知道哪一个定时任务没配好瞎跑; 比如忘记配成开机自启动; 比如曾经线上环境B与环境A并存导致定时任务互相争抢; 不知道现在线上跑了多少个定时任务,都是干什么的,负责人都是谁; 有些定时任务非常重要,不能单点,但又不能同时起多个 crontab,只能采取 master/slave 模式跑——比如退款处理。 什么是JobCenter? 窝窝的定时任务管理和调度平台,一个实用工具, 它是一个由 任务管理、任务调度、任务监控报警以及宿主任务执行(注意不再是 crontab了) 这四部分组成的,分布式多任务协调系统 。 2012年时,我看到暴风影音的马晨开源了一个 CronHub(时间调度系统)项目 (

gpg encrypt file without keyboard interaction [closed]

可紊 提交于 2019-11-27 00:25:27
问题 I am running next command within a crontab to encrypt a file and I don't want a keyboard interaction echo "PASSPHRASE" | gpg --passphrase-fd 0 -r USER --encrypt FILENAME.TXT but I have this answer: gpg: C042XXXX: There is no assurance this key belongs to the named user pub 40XXX/C042XXXX 2012-01-11 Name LastName. (comment) <user@email.com> Primary key fingerprint: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX Subkey fingerprint: XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX It is NOT

Restarting cron after changing crontab file?

99封情书 提交于 2019-11-26 23:46:27
问题 Do I have to restart cron after changing the crontable file? 回答1: No. From the cron man page: ...cron will then examine the modification time on all crontabs and reload those which have changed. Thus cron need not be restarted whenever a crontab file is modified But if you just want to make sure its done anyway, sudo service cron reload or /etc/init.d/cron reload 回答2: On CentOS with cPanel sudo /etc/init.d/crond reload does the trick. On CentOS7: sudo systemctl start crond.service 回答3: I had

linux计划任务

老子叫甜甜 提交于 2019-11-26 23:14:17
本章架构: 1.什么是例行性工作调度 2.仅执行一次的工作调度 3.循环执行的例行性工作调度 4.可唤醒停机期间的工作任务 一、什么是例行性工作调度 两种工作调度的方式: 一种是例行性的,就是每隔一定的周期要来办的事项 一种是突发性的,就是这次做完以后就没有的哪一种 1.在Linux下面如何达到这两个功能呢 。 1.at :at 是个可以处理仅执行一次就结束调度的指令,不过要执行 at 时, 必须要有 atd 这个服务 的支持才行。在 某些新版的 distributions 中,atd 可能默认并没有启动,那么 at 这个指令就会失效呢!不过我们的 CentOS 默认是启动的! 2.crontab :crontab 这个指令所设置的工作将会循环的一直进行下去! 可循环的时间为分钟、小时、每周、每月或每年等。 crontab 除了可以使用指令执行外,亦可编辑 /etc/crontab 来支持。 至于让 crontab 可以生效的服务则是 crond 这个服务喔! 2.Linux系统常见的例行性任务 二、执行一次的工作调度 1.调度服务at指令 at 的工作情况: * 先找寻 /etc/at.allow 这个文件,写在这个文件中的使用者才能使用 at ,没有在这个文件中的使用者则不能使用 at (即使没有写在 at.deny 当中); * 如果 /etc/at.allow 不存在

crontab PATH and USER

点点圈 提交于 2019-11-26 22:13:59
问题 I am new to scheduling tasks with cron and crontab. I am trying to schedule execution of a task as if I had logged on, opened a terminal, and executed it myself. However, I scheduled a task to help me observe what $USER and $PATH a scheduled task is executing with, and this is what I found: $ crontab -l 41 11 * * * echo "USER: $USER" > ~/Desktop/cron_env.log; echo "PATH: $PATH" >> ~/Desktop/cron_env.log $ cat ~/Desktop/cron_env.log USER: PATH: /usr/bin:/bin It appears as though $USER is not

Percent sign % not working in crontab

∥☆過路亽.° 提交于 2019-11-26 22:01:41
问题 I have a cron issue with curl : curl -w "%{time_total}\n" -o /dev/null -s http://myurl.com >> ~/log works great and add a line in log file with total_time. But the same line with cron doesn't do anything. It's not a path problem because curl http://myurl.com >> ~/log works. 回答1: % is a special character for crontab . From man 5 crontab : The "sixth" field (the rest of the line) specifies the command to be run. The entire command portion of the line, up to a newline or a "%" character, will be

Executing php with crontab

扶醉桌前 提交于 2019-11-26 20:36:16
I'm trying to run a php-script on a scheduled basis. So I'd thought crontab was a good idea. The server I'm using is on Linux which I'm not that familiar with. So the problem I'm having is, I don't know how make the script executable from php. I need to reference the script, or put it into a folder that can run php from the command line. So I don't know what path to give my crontab, for example: 5 * * * * var/www/some/path/script.php I found some vague information about this php executable being found in /usr/bin/php But I can't find any php file in there, maybe I don't have it installed? My