首页 \ 问答 \ 从外壳设置`ulimit -c`(set `ulimit -c` from outside shell)

从外壳设置`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.

相关问答

更多
  • 这表示作为参考的变量并且完全有效。 在大多数情况下,请忽略它并继续。 在这种特殊情况下,这可能意味着数组的最后一个元素仍然从您的foreach循环中引用。 由于您将其用作Reference,因此在循环关闭后,循环中的最后一项仍然存在,该项目的引用仍然存在。 或简而言之: 在循环之后,$字母仍然是对$字母的引用[2]。 如果您未unset($letter) ,那么&符号应该消失。 http://php.net/manual/en/language.references.php This denotes a v ...
  • 这是一个Xdebug错误。 解决方案: 禁用xdebug。 禁用xdebug的输出: This is an Xdebug bug. Solution: disable xdebug. Output with xdebug disabled:
  • 只需将$ arr传递给另一个数组变量即可 $foo = array(); $foo = $arr; Just pass the $arr to another array variable $foo = array(); $foo = $arr;
  • 首先,请注意普通的git diff给出了工作树和索引之间的差异(即仍然可以暂存的内容),而不是即将提交的内容。 使用git diff --cached来查看即将提交的内容。 我在试验时遇到的第二件事是使用if [ -z $VAR ]直接抛出错误,因为git diff输出开头的+由Bash解释。 确保用引号括$VAR以防止这种情况发生。 至于脚本,如果$VAR为空,你忘了否定测试。 如果grep的输出为空,则找不到“var_dump”,并且钩子应该返回成功。 你想要的情况是,如果它不是空的,意味着找到“var ...
  • 根据您的结构,您有一个包含对象的数组。 似乎getavgTimeOnSite()是一个访问数据的实用工具方法? 所以你的array和object数据并没有真正帮助调试。 好吧,除了让我知道有一个带有object的array ! 所以也许您可以像这样访问数据: echo '
    Avg TimeOnSite
    ' . $resultsTotal[0]->getavgTimeOnSite() . '
    '; 甚至用foreach滚动数组: foreach ($re ...
  • 我想我发现了错误。 出于某种原因,我无法读取$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.
  • 我假设你期望var_dump到浏览器。 Ajax发生在“幕后”,因此它不会输出到您的浏览器,您将在success处理程序的response参数中使用它。 如果你想测试它,只需用浏览器直接点击网址即可。 http://ciroot/index.php/publishlinks/check_links?matchesJSON=test%20text 此外 ,您可以使用浏览器扩展Firebug监视所有AJAX请求/响应,在这种情况下非常有用。 I assume you're expecting it to va ...
  • 你需要自己写。 看看get_class_methods 。 你需要有这个类名。 你可以通过get_class获得这个。 所以你想在你的库中引入这样的东西: function getObjectMethods(object $obj) { $className = get_class($obj); return get_class_methods($className); } 也许你应该考虑一个更好的IDE,它支持类型提示等。以PHPStorm为例。 You need to write yo ...
  • 你有没有尝试过: 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_get_c ...
  • 该对象是“懒惰地”实现的,即它不会从服务器检索数据,直到它实际需要(即您从结果对象访问某些内容)。 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). var_d ...

相关文章

更多

最新问答

更多
  • 如何在Laravel 5.2中使用paginate与关系?(How to use paginate with relationships in Laravel 5.2?)
  • linux的常用命令干什么用的
  • 由于有四个新控制器,Auth刀片是否有任何变化?(Are there any changes in Auth blades due to four new controllers?)
  • 如何交换返回集中的行?(How to swap rows in a return set?)
  • 在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)
  • 使用Boost.Spirit Qi和Lex时的空白队长(Whitespace skipper when using Boost.Spirit Qi and Lex)
  • Java中的不可变类(Immutable class in Java)
  • WordPress发布查询(WordPress post query)
  • 如何在关系数据库中存储与IPv6兼容的地址(How to store IPv6-compatible address in a relational database)
  • 是否可以检查对象值的条件并返回密钥?(Is it possible to check the condition of a value of an object and JUST return the key?)
  • GEP分段错误LLVM C ++ API(GEP segmentation fault LLVM C++ API)
  • 绑定属性设置器未被调用(Bound Property Setter not getting Called)
  • linux ubuntu14.04版没有那个文件或目录
  • 如何使用JSF EL表达式在param中迭代变量(How to iterate over variable in param using JSF EL expression)
  • 是否有可能在WPF中的一个单独的进程中隔离一些控件?(Is it possible to isolate some controls in a separate process in WPF?)
  • 使用Python 2.7的MSI安装的默认安装目录是什么?(What is the default installation directory with an MSI install of Python 2.7?)
  • 寻求多次出现的表达式(Seeking for more than one occurrence of an expression)
  • ckeditor config.protectedSource不适用于editor.insertHtml上的html元素属性(ckeditor config.protectedSource dont work for html element attributes on editor.insertHtml)
  • linux只知道文件名,不知道在哪个目录,怎么找到文件所在目录
  • Actionscript:检查字符串是否包含域或子域(Actionscript: check if string contains domain or subdomain)
  • 将CouchDB与AJAX一起使用是否安全?(Is it safe to use CouchDB with AJAX?)
  • 懒惰地初始化AutoMapper(Lazily initializing AutoMapper)
  • 使用hasclass为多个div与一个按钮问题(using hasclass for multiple divs with one button Problems)
  • Windows Phone 7:检查资源是否存在(Windows Phone 7: Check If Resource Exists)
  • 无法在新线程中从FREContext调用getActivity()?(Can't call getActivity() from FREContext in a new thread?)
  • 在Alpine上升级到postgres96(/ usr / bin / pg_dump:没有这样的文件或目录)(Upgrade to postgres96 on Alpine (/usr/bin/pg_dump: No such file or directory))
  • 如何按部门显示报告(How to display a report by Department wise)
  • Facebook墙贴在需要访问令牌密钥后无法正常工作(Facebook wall post not working after access token key required)
  • Javascript - 如何在不擦除输入的情况下更改标签的innerText(Javascript - how to change innerText of label while not wiping out the input)
  • WooCommerce / WordPress - 不显示具有特定标题的产品(WooCommerce/WordPress - Products with specific titles are not displayed)