从外壳设置`ulimit -c`(set `ulimit -c` from outside shell)

我有一个程序在启动时自动运行,并且偶尔会导致coredump。

我想记录输出,但我似乎无法以编程方式设置ulimit -c (默认为0,并且每次都重置)。

我尝试过使用bash脚本,以及python的shos.systemos.system ,但是我无法使它工作。


I have a program that's running automatically on boot, and sporadically causing a coredump.

I'd like to record the output, but I can't seem to set ulimit -c programmatically (It's defaulted to 0, and resets every time).

I've tried using a bash script, as well as python's sh, os.system and subprocess, but I can't get it to work.


原文:https://stackoverflow.com/questions/25475906
2023-10-20 06:10

满意答案

根据您的结构,您有一个包含对象的数组。 似乎getavgTimeOnSite()是一个访问数据的实用工具方法? 所以你的arrayobject数据并没有真正帮助调试。 好吧,除了让我知道有一个带有objectarray ! 所以也许您可以像这样访问数据:

echo '<div><span>Avg TimeOnSite</span><br />' . $resultsTotal[0]->getavgTimeOnSite() . '</div>';

甚至用foreach滚动数组:

foreach ($resultsTotal as $result) {
    echo '<div><span>Avg TimeOnSite</span><br />' . $result->getavgTimeOnSite() . '</div>';
}

我还找到了一个项目的源代码,该项目显示了开发人员如何访问Google Analytics请求中的数据。 查看它以获得有关如何访问数据的更多见解。


Based on your structure you have an array with objects. Also it seems like getavgTimeOnSite() is a utility method that accesses the data? So your array and object data doesn’t really help debug much. Well, other than letting me know there is an array with an object in it! So perhaps you can access the data like this:

echo '<div><span>Avg TimeOnSite</span><br />' . $resultsTotal[0]->getavgTimeOnSite() . '</div>';

Or even roll through the array with a foreach:

foreach ($resultsTotal as $result) {
    echo '<div><span>Avg TimeOnSite</span><br />' . $result->getavgTimeOnSite() . '</div>';
}

I also found this source code for a project that shows how the developer is accessing data in Google Analytics requests. Check it out to get more insights into how to access data.

相关问答

更多

&符号前置于数组var_dump的末尾(Ampersand prepended at end of array var_dump)

这表示作为参考的变量并且完全有效。 在大多数情况下,请忽略它并继续。 在这种特殊情况下,这可能意味着数组的最后一个元素仍然从您的foreach循环中引用。 由于您将其用作Reference,因此在循环关闭后,循环中的最后一项仍然存在,该项目的引用仍然存在。 或简而言之: 在循环之后,$字母仍然是对$字母的引用[2]。 如果您未unset($letter) ,那么&符号应该消失。 http://php.net/manual/en/language.references.php This denote...

var_dump()和print_r()输出不同的值(var_dump() and print_r() output different values)

这是一个Xdebug错误。 解决方案: 禁用xdebug。 禁用xdebug的输出: This is an Xdebug bug. Solution: disable xdebug. Output with xdebug disabled:

php导出var_dump值(php export var_dump values)

只需将$ arr传递给另一个数组变量即可 $foo = array(); $foo = $arr; Just pass the $arr to another array variable $foo = array(); $foo = $arr;

当var_dump存在时,中止git pre-commit钩子(aborting git pre-commit hook when var_dump present)

首先,请注意普通的git diff给出了工作树和索引之间的差异(即仍然可以暂存的内容),而不是即将提交的内容。 使用git diff --cached来查看即将提交的内容。 我在试验时遇到的第二件事是使用if [ -z $VAR ]直接抛出错误,因为git diff输出开头的+由Bash解释。 确保用引号括$VAR以防止这种情况发生。 至于脚本,如果$VAR为空,你忘了否定测试。 如果grep的输出为空,则找不到“var_dump”,并且钩子应该返回成功。 你想要的情况是,如果它不是空的,意味着找...

var_dump存在值但不能调用它们(var_dump present values but cant call them)

根据您的结构,您有一个包含对象的数组。 似乎getavgTimeOnSite()是一个访问数据的实用工具方法? 所以你的array和object数据并没有真正帮助调试。 好吧,除了让我知道有一个带有object的array ! 所以也许您可以像这样访问数据: echo '<div><span>Avg TimeOnSite</span><br />' . $resultsTotal[0]->getavgTimeOnSite() . '</div>'; 甚至用foreach滚动数组: foreach...

dd()读取var_dump()无法读取的值(dd() reads values that var_dump() can't read)

我想我发现了错误。 出于某种原因,我无法读取$group->value ,但$group["value"]有效。 可能该group是关键字。 I think I found the error. For some reason I cannot read $group->value, but $group["value"] works. It may be that group is a keyword.

Codeigniter echo / var_dump无法正常工作(Codeigniter echo/var_dump not working)

我假设你期望var_dump到浏览器。 Ajax发生在“幕后”,因此它不会输出到您的浏览器,您将在success处理程序的response参数中使用它。 如果你想测试它,只需用浏览器直接点击网址即可。 http://ciroot/index.php/publishlinks/check_links?matchesJSON=test%20text 此外 ,您可以使用浏览器扩展Firebug监视所有AJAX请求/响应,在这种情况下非常有用。 I assume you're expecting it ...

PHP中的方法是否有相当于var_dump的方法?(Is there an equivalent of var_dump for methods in PHP?)

你需要自己写。 看看get_class_methods 。 你需要有这个类名。 你可以通过get_class获得这个。 所以你想在你的库中引入这样的东西: function getObjectMethods(object $obj) { $className = get_class($obj); return get_class_methods($className); } 也许你应该考虑一个更好的IDE,它支持类型提示等。以PHPStorm为例。 You need to wri...

PHP拒绝从var_dump,print等输出数据(PHP refuses to output data from var_dump, print, etc)

你有没有尝试过: ob_start(); var_dump("Var_dump($res) output in a string"); $out = ob_get_clean(); echo $out; 在WAMP和ob_start / ob_get_clean工作时,var_dump本身对我不起作用。 Have you tried: ob_start(); var_dump("Var_dump($res) output in a string"); $out = ob_...

结果的var_dump给出null值。(var_dump of result gives null value. But deeper inspection returns a integer [duplicate])

该对象是“懒惰地”实现的,即它不会从服务器检索数据,直到它实际需要(即您从结果对象访问某些内容)。 var_dump似乎没有触发属性getter,因此它们显示为null 。 The object is implemented "lazily", i.e. it does not retrieve data from the server until it's actually required (i.e. you access something from the result object). ...

相关文章

更多

Shell的分类

Shell主要分为图形界面和命令行两种。Graphical User Interface shell, ...

linux shell awk 语法

linux shell awk 语法 Awk 是一种非常好的语言,同时有一个非常奇怪的名称。在本系列( ...

shell脚本常规技巧

邮件相关 发送邮件: #!/usr/bin/pythonimport sys;import s ...

Linux命令、编辑器、Shell编程实例大全

《Linux命令、编辑器、Shell编程实例大全》全面、系统地介绍了Linux命令、编辑器及Shell ...

Linux Shell Scripting Cookbook(Linux Shell脚本攻略_英文版.pdf)

Linux Shell Scripting Cookbook的内容摘要:中文名:Linux Shell ...

Python内建函数(C)

callable(object) 说明:检查对象object是否可调用。如果返回True,ob ...

《C/C++图像处理编程》扫描版[PDF]

中文名: C/C++图像处理编程 作者: 陆宗骐 图书分类: 网络 资源格式: PD ...

使用Shell客户端操作kafka

在master上创建一个test1主题 /opt/kafka/kafka_2.10-0.9.0.1/b ...

C语言面试题(带答案)三

1.有以下表达式: int a=248; b=4;int const c=21;const int * ...

bash shell循环的疑问

下面两段代码 第一段,无法正确统计文件行数,count在循环中的计算,出了循环就无效了 第二段,c ...

最新问答

更多

获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)

我用Google搜索了一个解决方案。 “EnumDisplayModeProvider”是我自己设置网站的各种模式的枚举。 public EnumDisplayModeProvider GetDisplayModeId() { foreach (var mode in DisplayModeProvider.Instance.Modes) if (mode.CanHandleContext(HttpContext)) {

如何通过引用返回对象?(How is returning an object by reference possible?)

这相对简单:在类的构造函数中,您可以分配内存,例如使用new 。 如果你制作一个对象的副本,你不是每次都分配新的内存,而是只复制指向原始内存块的指针,同时递增一个也存储在内存中的引用计数器,使得每个副本都是对象可以访问它。 如果引用计数降至零,则销毁对象将减少引用计数并仅释放分配的内存。 您只需要一个自定义复制构造函数和赋值运算符。 这基本上是共享指针的工作方式。 This is relatively easy: In the class' constructor, you allocate m

矩阵如何存储在内存中?(How are matrices stored in memory?)

正如它在“熵编码”中所说的那样,使用Z字形图案,与RLE一起使用,在许多情况下,RLE已经减小了尺寸。 但是,据我所知,DCT本身并没有给出稀疏矩阵。 但它通常会增强矩阵的熵。 这是compressen变得有损的点:输入矩阵用DCT传输,然后量化量化然后使用霍夫曼编码。 As it says in "Entropy coding" a zig-zag pattern is used, together with RLE which will already reduce size for man

每个请求的Java新会话?(Java New Session For Each Request?)

你是如何进行重定向的? 您是否事先调用了HttpServletResponse.encodeRedirectURL()? 在这里阅读javadoc 您可以使用它像response.sendRedirect(response.encodeRedirectURL(path)); The issue was with the path in the JSESSIONID cookie. I still can't figure out why it was being set to the tomca

css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)

我认为word-break ,如果你想在一个单词中打破行,你可以指定它,这样做可以解决问题: .column { word-break:break-all; } jsFiddle演示。 您可以在此处阅读有关word-break属性的更多信息。 I think word-break, with which you can specify if you want to break line within a word, will do the trick: .column { word-break

无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)

我认为您忘记在分类时间内缩放输入图像,如train_test.prototxt文件的第11行所示。 您可能应该在C ++代码中的某个位置乘以该因子,或者使用Caffe图层来缩放输入(请查看ELTWISE或POWER图层)。 编辑: 在评论中进行了一次对话之后,结果发现在classification.cpp文件中错误地删除了图像均值,而在原始训练/测试管道中没有减去图像均值。 I think you have forgotten to scale the input image during cl

xcode语法颜色编码解释?(xcode syntax color coding explained?)

转到: Xcode => Preferences => Fonts & Colors 您将看到每个语法高亮颜色旁边都有一个简短的解释。 Go to: Xcode => Preferences => Fonts & Colors You'll see that each syntax highlighting colour has a brief explanation next to it.

在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)

你考虑过第三方拼写检查吗? 您可以将在C#中开发的自定义WinForms控件插入访问数据库吗? VB6控件怎么样? 如果你能找到一个使用第三方库进行拼写检查的控件,那可能会有效。 Have you considered a third party spell checker? Can you insert a custom WinForms controls developed in C# into an access database? What about a VB6 control? If

从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)

我有同样的问题,因为我在远程服务器上有两个图像,我需要在每天的预定义时间复制到我的本地服务器,这是我能够提出的代码... try { if(@copy('url/to/source/image.ext', 'local/absolute/path/on/server/' . date("d-m-Y") . ".gif")) { } else { $errors = error_get_last(); throw new Exception($err

从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))

我不确定我完全明白你在说什么。 你能编辑你的帖子并包含你正在做的Subversion命令/操作的特定顺序吗? 最好使用命令行svn客户端,以便容易为其他人重现问题。 如果您只是想获取文件的旧副本(即使该文件不再存在),您可以使用如下命令: svn copy ${repo}/trunk/moduleA/file1@${rev} ${repo}/trunk/moduleB/file1 其中${repo}是您的存储库的URL, ${rev}是您想要的文件的版本。 这将恢复该文件的旧版本,包括最高版本