首页 \ 问答 \ ubuntu 10.10中的Php Cron工作不执行lampp - 需要帮助(Php Cron job in ubuntu 10.10 does not execute for lampp - Help needed)

ubuntu 10.10中的Php Cron工作不执行lampp - 需要帮助(Php Cron job in ubuntu 10.10 does not execute for lampp - Help needed)

我需要一些日常cron工作的帮助,我想在ubuntu 10.10下安排。 我通过crontab -e添加了这个工作,当我做crontab -l ,它看起来没问题。 路径和命名都很好:

58 23 * * * /usr/bin/php -f /home/eem/cars1/cron/cronjob1.php

但是,cron不会执行。 我试图从gnome调度程序手动运行它。 没有成功。 我厌倦了使用此命令从控制台手动运行它,再次没有成功:

/usr/bin/php -f /home/eem/cars1/cron/cronjob1.php

我的var / log / syslog显示该文件已执行但Xampp上的网站没有任何变化:

May 14 06:27:57 eem-VirtualBox /usr/bin/crontab[31959]: (eem) LIST (eem)

此命令: */5 * * * * echo hello crontab -e */5 * * * * echo hello执行并显示在syslog中:

May 14 05:40:01 eem-VirtualBox CRON[31085]: (eem) CMD (echo hello)
May 14 05:40:01 eem-VirtualBox CRON[31084]: (CRON) info (No MTA installed, discarding output)

下面是一些诊断:

Command1ps -C cron

终端

PID TTY          TIME CMD
  881 ?        00:00:02 cron

var / log / syslog

May 14 05:17:01 eem-VirtualBox CRON[31033]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)

Command2 :: cat /etc/crontab

终奌站:

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#

Command3: ls /usr/sbin/anacron

终端: /usr/sbin/anacron


Command4: grep CRON /var/log/syslog

终端:这个以及更多:

5月14日05:09:01 eem-VirtualBox CRON [30048] :( root)CMD([-x / usr / lib / php5 / maxlifetime] && [-d / var / lib / php5] && find / var / lib / php5 / -depth -mindepth 1 -maxdepth 1-type f -cmin + $(/ usr / lib / php5 / maxlifetime)! - execdir fuser -s {} 2> / dev / null \; -delete)5月14日05: 17:01 eem-VirtualBox CRON [31033] :( root)CMD(cd / && run-parts --report /etc/cron.hourly)

为长篇大论道歉,但经过几天的挣扎,我迫不及待地想找到问题。 希望在此之后对其他人有所帮助。


I need some help with a daily cron job I am trying to schedule under ubuntu 10.10. I have added the job via crontab -e and when I do crontab -l, it looks ok. Path and naming are fine:

58 23 * * * /usr/bin/php -f /home/eem/cars1/cron/cronjob1.php

However, the cron does not execute. I have tried to run it manually from gnome scheduler. No success. I tired to run it manually from the console with this command, again without success:

/usr/bin/php -f /home/eem/cars1/cron/cronjob1.php

My var/log/syslog show that the file is executed but nothing changes in the website on Xampp:

May 14 06:27:57 eem-VirtualBox /usr/bin/crontab[31959]: (eem) LIST (eem)

This command: */5 * * * * echo hello in crontab -e executes and shows in syslog:

May 14 05:40:01 eem-VirtualBox CRON[31085]: (eem) CMD (echo hello)
May 14 05:40:01 eem-VirtualBox CRON[31084]: (CRON) info (No MTA installed, discarding output)

Below some diagnostics:

Command1: ps -C cron

Terminal:

PID TTY          TIME CMD
  881 ?        00:00:02 cron

var/log/syslog:

May 14 05:17:01 eem-VirtualBox CRON[31033]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)

Command2:: cat /etc/crontab

Terminal:

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# m h dom mon dow user  command
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#

Command3: ls /usr/sbin/anacron

Terminal: /usr/sbin/anacron


Command4: grep CRON /var/log/syslog

Terminal:: This and much more:

May 14 05:09:01 eem-VirtualBox CRON[30048]: (root) CMD ( [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib/php5/maxlifetime) ! -execdir fuser -s {} 2>/dev/null \; -delete) May 14 05:17:01 eem-VirtualBox CRON[31033]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)

Apologies for the long post but after struggling for several days with this I am desperate to find the problem. Hopefully, it will be helpful to other people after that.


原文:https://stackoverflow.com/questions/22255623
更新时间:2022-01-16 10:01

最满意答案

查看pthread_cancel的手册页:

当请求的取消被执行时,线程会发生以下步骤(按此顺序):

   1. Cancellation clean-up handlers are popped (in the reverse of the order in
      which they were pushed) and called.  (See pthread_cleanup_push(3).)

   2. Thread-specific data destructors are called, in an unspecified order.  (See
      pthread_key_create(3).)

   3. The thread is terminated.  (See pthread_exit(3).)

因此,如果您使用上述函数正确注册了清理处理程序,则可以使用main中的pthread_cancel

(尽管完全阅读了这个手册页,它有很多重要的信息。)

编辑 :(来自评论)如果您打算使用PTHREAD_CANCEL_DEFERRED并且需要在代码中的某处插入取消点,请使用pthread_testcancel 。 此功能检查是否请求取消。 如果是这种情况,则取消服务(即该呼叫永远不会返回)。 否则它没有效果。


Look at the man page for pthread_cancel:

When a cancellation requested is acted on, the following steps occur for thread (in this order):

   1. Cancellation clean-up handlers are popped (in the reverse of the order in
      which they were pushed) and called.  (See pthread_cleanup_push(3).)

   2. Thread-specific data destructors are called, in an unspecified order.  (See
      pthread_key_create(3).)

   3. The thread is terminated.  (See pthread_exit(3).)

So you can use pthread_cancel from your main, provided you have registered you cleanup handlers correctly using the above functions.

(Do read that man page completely though, it has a lot of important information.)

Edit: (from comments) If you plan on using PTHREAD_CANCEL_DEFERRED and need to insert a cancellation point somewhere in your code, then use pthread_testcancel. This function checks if a cancellation was requested. If that is the case, the cancellation is serviced (i.e. that call never returns). Otherwise it has no effect.

相关问答

更多
  • 我可以看到线程运行,信号被截获 你确定吗? 我认为信号不是发送的事件。 但是没有执行发布的处理程序。 我究竟做错了什么? 您的构造函数创建一个新线程,然后等待它完成,因此构造函数不会返回,直到新线程退出。 这意味着在接收器线程退出之前, main这一行不会执行: Package1Signals::getInstance()->signal1(); 也许您希望boost::thread成为您的类的成员,因此它与您的类具有相同的生命周期,而不是构造函数中的局部变量。 对于样式考虑,你不需要使用boost:: ...
  • 管道上的阻塞read是异步信号安全的 ,并提供了一种方便的方法来唤醒“挂起”线程。 例如, static int the_pipe[2] = {-1, -1}; // file descriptors allocated in main via pipe() static void siginfo_handler(int s, siginfo_t *si, void *ctx) { char c; // do something with (ucontext_t *)ctx // now ...
  • 当进程收到信号时,它将在进程的上下文中处理。 您应该只在信号处理程序中使用异步安全函数或重入函数。 例如,您不能在信号处理程序中调用malloc()或printf()。 原因是: *)假设您收到信号时您的进程正在malloc中执行。 因此全局堆数据结构处于不一致状态。 现在,如果从信号处理程序内部获取堆锁并进行更改,则会进一步使堆不一致。 *)另一种可能性是,如果你的进程在接收到信号时已经获取了堆锁,然后你从信号处理程序调用malloc(),它会看到锁被保持并且它无限地等待获取锁(无限因为在信号完全处理之前 ...
  • 有几个问题。 1)信号处理程序签名不正确。 它应该采用int而你没有参数定义它。 即 static void proxy_singnal_handler(){ 应该 static void proxy_singnal_handler(int sig){ 2)您不能从信号处理程序(在您的情况下为printf()中调用非异步信号安全的函数。 有关详细信息,请参阅信号(7) 。 您可以改为使用write(2)来打印该消息: printf("Hello\n"); 可: write(1, "Hello\n", ...
  • 正如此处所述: http : //www.gnu.org/software/libc/manual/html_node/Nonreentrancy.html#Nonreentrancy 如果一个函数使用并修改了你提供的对象,那么它可能是不可重入的; 如果两个调用使用同一个对象,则可能会造成干扰 在你的情况下,该对象是stdout 。 当信号到达(f)printf()的中间,并且如果在处理程序中使用(f)printf ,则两个数据在同一个流stdout上运行时可能会损坏。 重入是这种情况下的根本原因。 即使您 ...
  • 从信号手册页 : 信号处理是一个每进程属性:在多线程应用程序中,特定信号的配置对于所有线程都是相同的。 所以,是的,当你设置一个信号处理程序时,它将处理发送给进程的信号; 信号不会单独发送到每个线程,它会被发送到任何一个未阻塞正在发送的特定消息的线程。 From the man page for signals: The signal disposition is a per-process attribute: in a multithreaded application, the disposition ...
  • 我做了一些调查,我发现问题的关键点不是线程,而是信号处理程序是否有足够的时间运行。 我做了一个简单的程序来重新生成Windows 7下的问题以及解决方案。 package main import ( "fmt" "io" "os" "os/signal" ) func main() { c := make(chan os.Signal, 1) //q := make(chan bool, 1) signal.Notify(c, os.Interru ...
  • 查看pthread_cancel的手册页: 当请求的取消被执行时,线程会发生以下步骤(按此顺序): 1. Cancellation clean-up handlers are popped (in the reverse of the order in which they were pushed) and called. (See pthread_cleanup_push(3).) 2. Thread-specific data destructors are called, ...
  • 这似乎是某种竞争条件,并且当有更多的事情发生时它会起作用。 use warnings; use strict; use feature 'say'; use threads; use threads::shared; my $thread_handler_on :shared = 0; sub test_handler { say "\tIn thread."; $SIG{'KILL'} = sub { $thread_handler_on = 1; s ...

相关文章

更多

最新问答

更多
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)
  • 是否可以嵌套hazelcast IMaps?(Is it possible to nest hazelcast IMaps? And whick side effects can I expect? Is it a good Idea anyway?)
  • UIViewAnimationOptionRepeat在两个动画之间暂停(UIViewAnimationOptionRepeat pausing in between two animations)
  • 在x-kendo-template中使用Razor查询(Using Razor query within x-kendo-template)
  • 在BeautifulSoup中替换文本而不转义(Replace text without escaping in BeautifulSoup)
  • 如何在存根或模拟不存在的方法时配置Rspec以引发错误?(How can I configure Rspec to raise error when stubbing or mocking non-existing methods?)
  • asp用javascript(asp with javascript)
  • “%()s”在sql查询中的含义是什么?(What does “%()s” means in sql query?)
  • 如何为其编辑的内容提供自定义UITableViewCell上下文?(How to give a custom UITableViewCell context of what it is editing?)
  • c ++十进制到二进制,然后使用操作,然后回到十进制(c++ Decimal to binary, then use operation, then back to decimal)
  • 以编程方式创建视频?(Create videos programmatically?)
  • 无法在BeautifulSoup中正确解析数据(Unable to parse data correctly in BeautifulSoup)
  • webform和mvc的区别 知乎
  • 如何使用wadl2java生成REST服务模板,其中POST / PUT方法具有参数?(How do you generate REST service template with wadl2java where POST/PUT methods have parameters?)
  • 我无法理解我的travis构建有什么问题(I am having trouble understanding what is wrong with my travis build)
  • iOS9 Scope Bar出现在Search Bar后面或旁边(iOS9 Scope Bar appears either behind or beside Search Bar)
  • 为什么开机慢上面还显示;Inetrnet,Explorer
  • 有关调用远程WCF服务的超时问题(Timeout Question about Invoking a Remote WCF Service)