首页 \ 问答 \ Bash将所有stdout输出到控制台和文件(Bash output all stdout both to console and file)

Bash将所有stdout输出到控制台和文件(Bash output all stdout both to console and file)

我试图将所有stdoutstderr到控制台和文件。 我知道./script | tee somefile ./script | tee somefile ,但这对我不起作用。 我想让它自动完成,而不是我从控制台管道。 我试过了

#!/bin/sh
exec 2>&1 | tee somefile
echo "..."

但那没用。 什么是正确的解决方案?


I am trying to output all stdout and stderr both to console and to a file. I know about ./script | tee somefile , but that doesn't work for me. I want it to do it automatically, without me piping it from the console. I've tried

#!/bin/sh
exec 2>&1 | tee somefile
echo "..."

but that didn't work. What would be the correct solution?


原文:https://stackoverflow.com/questions/46498540
更新时间:2023-09-09 21:09

最满意答案

如果永远不提交事务,它将超时,SQLServer将执行回滚。 SQLServer将处理此问题,而不是EF。


If a transaction is never committed, it will timeout and the SQLServer will perform a rollback. The SQLServer will handle this, not EF.

相关问答

更多
  • 我能够通过将故障优先约束从DFT更改为回滚EST从逻辑与到逻辑或来解决此问题。 I was able to solve this problem by changing the failure precedence constraint from DFT to Rollback EST from Logical AND to Logical OR.
  • 如果永远不提交事务,它将超时,SQLServer将执行回滚。 SQLServer将处理此问题,而不是EF。 If a transaction is never committed, it will timeout and the SQLServer will perform a rollback. The SQLServer will handle this, not EF.
  • 使用您的代码,将只执行一次回滚,具体取决于条件。 您可以编写多个DB::rollback() ,只要只执行一个。 要回答这个问题,可以进行多次回滚,如果使用嵌套事务,并使用回滚/提交返回上一级别。 With your code, only one rollback will be executed, depending on the conditions. You can write multiple DB::rollback(), as long as only one gets executed. To ...
  • 从Aries邮件列表中获得一些帮助后,结果发现问题出在数据源配置中,而不是蓝图配置中。 虽然我使用MysqlXADataSource作为驱动程序类,但数据源服务已注册为javax.sql.DataSource而不是javax.sql.XADataSource ,这是弄乱我的事务。 After getting some help form the Aries mailing list it turns out the problem was in the datasource configuration an ...
  • 由于整个当前事务都标记为回滚,因此第二次调用EJB也将被回滚。 您必须为RPMRequestSessionBeanRemote bean使用@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)或@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) ,具体取决于您是否还需要事务处理。 Since the whole current transaction is marked ...
  • 您无需调用update()来使更改持久化。 将自动保存对托管实体的更改。 update()用于将分离的实体附加到会话。 您的实体已附加。 关于回滚,Spring测试会在测试结束时自动回滚 ,除非你告诉Spring不要这样做。 You don't need to call update() to make the changes persistent. Changes to a managed entity are saved automatically. And update() is used to at ...
  • 让你的模型需要同步来实现一个接口,例如iSyncable,承诺一旦模型成功保存就会同步。 如果您通过导航属性拥有相关表,请保存所有内容并将其放入导航属性,然后再进行同步,以便同步功能具有所需的所有对象。 顺便说一句,如果您需要进行任何数据转换,这将是您执行此操作的地方。 Have your models that require syncing to implement an interface, iSyncable for example, that promises that you will sync ...
  • 这是预期的行为? 是的。 如果第一号是肯定的,那么我就会发现异常,那么Spring怎么可能知道抛出了异常呢? 当发生异常时,spring会将您的事务标记为rollbackOnly 。 所以,即使您发现异常,在您的方法结束时,您的交易仍会回滚。 在你的情况下,我不明白你为什么使用@Transaction因为你想提交,无论发生异常。 编辑 当您使用DB处理事务时,事务调用被委托给EntityManager。 看看AbstractEntityManagerImpl#handlePersistenceExcepti ...
  • 为什么不简单地做: @transaction.commit_manually def save(self, *args, **kwargs): try: super(self.__class__, self).save(*args, **kwargs) self.qa.vote_down_count += 1 self.qa.save() except: transaction.rollback() raise ...
  • 事务状态附加到特定的ObjectifyImpl实例。 您正在启动一个事务(通过static ofy()方法创建一个新的ObjectifyImpl),然后重新使用旧的非事务性ObjectifyImpl实例。 因此,即使您正在回滚事务,您的保存操作也会使用来自事务外部的非事务性Objectify impl。 这就是为什么文档表明你永远不会在变量中持有Objectify实例的原因; 总是使用静态ofy()方法。 您可以创建自己的静态ofy()(或其他)方法来返回您的Dao类型。 查看http://www.moto ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • 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)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置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])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)