nohup

nohup as background task does NOT return prompt

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am trying to run a long running task in the background without having to be logged in and have the terminal return a prompt, but when I do this, the task appears to go into the background, but my prompt does not become available unless I hit control + c. I want to run the task and then get my prompt back. [ staging@php - pos - web ~] $ nohup php test . php > test . txt & [ 1 ] 27251 [ staging@php - pos - web ~] $ nohup : ignoring input and redirecting stderr to stdout 回答1: You should have your prompt available because your

What's the nohup on Windows?

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to run a Java jar file like this: java -jar spider.jar How to run it on the background on Windows? Like this on Linux: nohup java -jar spider.jar > /var/tmp/spider.log 2>&1 & 回答1: On Windows it's not normal that a process terminates once its parent was killed (like Unix-likes do it normally). Therefore there is no direct necessity for something like nohup . If you want to avoid the console window associated with it, you can use javaw but redirection won't work, then. 回答2: You could use the Windows start command: start /min java -jar

Nohup and Python -u : it still doesn't log data in realtime

匿名 (未验证) 提交于 2019-12-03 02:15:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: When launching a Python process, in background, with nohup python myscript . py > test . log 2 >& 1 < /dev/ null & the problem is that stdout is buffered: the data is not written in realtime to test.log . The common solution to this problem is to flush periodically with sys.stdout.flush() , or even better, as suggested by this answer , to use python -u : nohup python - u myscript . py > test . log 2 >& 1 < /dev/ null & But this is not enough . I noticed that it worked during a few hours, and then, it stopped working, i.e. after a

remote gdb

≡放荡痞女 提交于 2019-12-03 01:54:55
moonx@moonx:/usr/download/test/mygcc$ cat testthread.cc -n 1 // thread example 2 #include <iostream> // std::cout 3 #include <thread> // std::thread 4 5 void foo() 6 { 7 // do stuff... 8 } 9 10 void bar(int x) 11 { 12 // do stuff... 13 } 14 15 int main() 16 { 17 std::thread first (foo); // spawn new thread that calls foo() 18 std::thread second (bar,0); // spawn new thread that calls bar(0) 19 20 std::cout << "main, foo and bar now execute concurrently...\n"; 21 22 // synchronize threads: 23 first.join(); // pauses until first finishes 24 second.join(); // pauses until second finishes 25 26

How to get a list of programs running with nohup

感情迁移 提交于 2019-12-03 01:45:27
问题 I am accessing a server running CentOS (linux distribution) with an SSH connection. Since I can't always stay logged in, I use "nohup [command] &" to run my programs. I couldn't find how to get a list of all the programs I started using nohup. "jobs" only works out before I log out. After that, if I log back again, the jobs command shows me nothing, but I can see in my log files that my programs are still running. Is there a way to get a list of all the programs that I started using "nohup" ?

liunx 部署 spring boot

匿名 (未验证) 提交于 2019-12-03 00:40:02
Xshell for Xmanager Enterprise 4 (Build 0232) Copyright (c) 2002-2014 NetSarang Computer, Inc. All rights reserved. Type `help‘ to learn how to use Xshell prompt. Xshell:\> Connecting to 192.168.0.51:22...解释:连接到本地服务 Connection established. To escape to local shell, press ‘Ctrl+Alt+]‘. WARNING! The remote SSH server rejected X11 forwarding request. Last login: Sun Jul 8 22:39:02 2018 from 192.168.1.180 解释:上次登录 [root@bogon ~]# ll 解释:查看本目录下的文件 total 177792 -rw-r--r-- 1 root root 16415 Dec 25 2017 192.168.0.5120171225.txt -rw-------. 1 root root 1155 Mar 6 2017 anaconda-ks.cfg -rw-r--r-- 1 root

springboot启动后总是自己shutdown

匿名 (未验证) 提交于 2019-12-03 00:30:01
springboot启动后总是自己shutdown 现象 这几天一直被一个问题困扰,每次springboot的tomcat启动之后, 然后过了一段时间看, 进程就突然自己关闭掉了。 然后日志是: ationConfigEmbeddedWebApplicationContext : Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@ 6 d5380c2: startup date [Sun Sep 24 17 : 51 : 04 CST 2017 ]; root of context hierarchy o.s.j.e.a. AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown j. LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' 解法 网上也有说这个问题, 但是大多数说的是, 这个是一个非 web应用, 需要添加这个依赖, 链接 < dependency > < groupId > org

shell 标准输入输出及错误输出 重定向

匿名 (未验证) 提交于 2019-12-03 00:15:02
标准输入,标准输出,错误输出(0 1 2) >/dev/null 2>&1。这条命令其实分为两命令,一个是>/dev/null,另一个是2>&1 采用&可以将两个输出绑定在一起 就是错误输出将会和标准输出输出到同一个地方 nohup结合 # nohup java -jar xxxx.jar & 为了不让一些执行信息输出到前台(控制台),我们还会加上刚才提到的>/dev/null 2>&1命令来丢弃所有的输出: # nohup java -jar xxxx.jar >/dev/null 2>&1 & 来源:博客园 作者: walkersss 链接:https://www.cnblogs.com/walkersss/p/11756811.html

nohup 日志按天输出

匿名 (未验证) 提交于 2019-12-02 23:55:01
输出日志在当前目录: nohup java -jar ace-auth.jar >> nohup`date +%Y-%m-%d`.out 2>&1 & 指定日志目录输出: 指定输出到当前目录log文件夹中 nohup java -jar ace-auth.jar >> ./log/nohup`date +%Y-%m-%d`.out 2>&1 & 来源:博客园 作者: 寒江――独钓 链接:https://www.cnblogs.com/jin-521/p/11417505.html

解决关闭ssh后网页停止服务的方法,利用nohup

匿名 (未验证) 提交于 2019-12-02 23:49:02
上一篇文章提到宝塔面板无法运行,只能用ssh运行app.py。 关闭ssh时,app.py会被杀死。因为app.py的父进程就是ssh,关掉ssh会造成进程被杀死。 nohup python app.py & 这样子相当于app.py不再是shh的子进程,那么只要服务器不关,他就会一直运行下去(也会有时间限制) 场景: 如果只是临时有一个命令需要长时间运行,什么方法能最简便的保证它在后台稳定运行呢? hangup 名称的来由 在 Unix 的早期版本中,每个终端都会通过 modem 和系统通讯。当用户 logout 时,modem 就会挂断(hang up)电话。 同理,当 modem 断开连接时,就会给终端发送 hangup 信号来通知其关闭所有子进程。 解决方法: 我们知道,当用户注销(logout)或者网络断开时,终端会收到 HUP(hangup)信号从而关闭其所有子进程。因此,我们的解决办法就有两种途径:要么让进程忽略 HUP 信号,要么让进程运行在新的会话里从而成为不属于此终端的子进程。 可见,nohup 的使用是十分方便的,只需在要处理的命令前加上 nohup 即可,标准输出和标准错误缺省会被重定向到 nohup.out 文件中。一般我们可在结尾加上 "&" 来将命令同时放入后台运行,也可用 来更改缺省的重定向文件名。