nohup

Linux部署Django:报错 nohup: ignoring input and appending output to ‘nohup.out’

南笙酒味 提交于 2019-12-06 00:19:49
一、部署 Django 到远程 Linux 服务器 利用 xshell 通过 ssh 连接到 Linux服务器,常规的启动命令是 python3 manage.py runserver 0.0.0.0:80 但是,关闭 xshell 后,就访问不了 Django 了。 这时候需要使用 nohup 命令启动(概念:如果你正在运行一个进程,而且你觉得在退出帐户时该进程还不会结束,那么可以使用nohup命令。该命令可以在你退出帐户/关闭终端之后继续运行相应的进程) 这时输入 nohup python3 manage.py runserver 0.0.0.0:80 此时会报错 nohup: ignoring input and appending output to ‘nohup.out’ 二、解决办法 1、原因 是因为使用 nohup 会产生日志文件,默认写入到 nohup.out 2、解决 将 nohup 的日志输出到 /dev/null,这个目录会让所有到它这的信息自动消失 nohup python3 manage.py runserver 0.0.0.0:80 > /dev/null 2> /dev/null & 来源: https://www.cnblogs.com/yebaofang/p/11953342.html

linux暂停和恢复进程

一曲冷凌霜 提交于 2019-12-05 19:27:34
kill -STOP 1234 将该进程暂停。 如果要让它恢复到后台,用kill -CONT 1234 (很多在前台运行的程序这样是不行的) 如果要恢复到前台,请在当时运行该进程的那个终端用jobs命令查询暂停的进程。 然后用 fg 〔job号〕把进程恢复到前台。 如果jobs只查询到一个进程,只用 fg 即可。 例:root@dWorks:~# bc -q [1]+ Stopped bc -q root@dWorks:~# bc -q [2]+ Stopped bc -q root@dWorks:~# jobs [1]- Stopped bc -q [2]+ Stopped bc -q root@dWorks:~# fg 2 bc -q 1+1 2 A,Shell支持作用控制,有以下命令: 1. command& 让进程在后台运行 2. jobs 查看后台运行的进程 3. fg %n 让后台运行的进程n到前台来 4. bg %n 让进程n到后台去; PS:"n"为jobs查看到的进程编号. B.下列转:http://blog.chinaunix.net/u/1604/showart_1079559.html fg、bg、jobs、&、ctrl + z都是跟系统任务有关的,虽然现在基本上不怎么需要用到这些命令,但学会了也是很实用的 一。& 最经常被用到这个用在一个命令的最后

nohup doesn't work with OS X Yosmite - get error “can't detach from console no such file or directory”

坚强是说给别人听的谎言 提交于 2019-12-05 19:13:48
问题 I use nohup to run a command from a php application (I have a web page that sends POST request to php server to start a shell script in background). It's something like exec('nohup /home/user/test.sh > /home/user/test.log 2>&1 &') This worked fine when I was using OS X Snow Leopard (OS X 10.6). However, recently I upgraded my MAC to OS X Yosemite (OS X 10.10) and now it doesn't work any more. In the test.log, I always get the message: nohup can't detach from console: no such file or directory

把nohup.out文件每天的输出打印到log日志文件下

这一生的挚爱 提交于 2019-12-05 14:44:16
linus 定时执行下列文件 作用:把nohup.out文件每天的输出打印到log日志文件下 this_path=$(cd `dirname $0`;pwd) cd $this_path echo $this_path current_date=`date -d "-1 day" "+%Y%m%d"` echo $current_date split -b 65535000 -d -a 4 /home/test/hup.out /home/test/log/log_${current_date}_ cat /dev/null > nohup.out    来源: https://www.cnblogs.com/ynhk/p/11928853.html

linux常用小知识

£可爱£侵袭症+ 提交于 2019-12-05 12:47:46
1. &: 为了在后台运行作业,需要在命令末键入&字符。 2. nohup: 如果你正在运行一个进程,而且你觉得在退出账户时该进程不应结束,那么可以使用nohup命令。该命令可以在你退出账户或关闭终端后继续运行相应的进程。缺省情况下,该作业的所有输出被重定向到一个名为nohup.out的文件中。 补:&是指在后台运行,但是当用户退出时,命令也跟着退出。nohup可以使命令永久执行下去,和用户终端没关系。结合起来使用就是nohup command &,这样就能使命令永久地在后台执行。 来源: https://www.cnblogs.com/i-hard-working/p/11925573.html

centOS7常用命令

纵饮孤独 提交于 2019-12-05 10:58:00
转载: https://www.cnblogs.com/yjd_hycf_space/p/7730690.html https://blog.csdn.net/weixin_43758377/article/details/100695566 查看端口占用情况: netstat -ant 验证某个端口号(8080)是否被占用 netstat -tunlp|grep 8080 查看所有监听端口号 netstat -lntp 删除所有包含gitlab的文件及目录 find / -name gitlab | xargs rm -rf find / -name *gitlab* | xargs rm -rf springboot程序后台启动: nohup java -jar xx.jar & 查看日志文件: #查看最后600行日志: tail -n 600 nohup.out #查看实时日志 tail -f nohup.out 给xxx.sh 文件开放所有权限(可读可写可执行)转载: https://www.cnblogs.com/Caiyundo/p/10413449.html [sh某文件出现错误Permission denied] chmod 777 xxx.sh 防火墙相关: 转载: https://www.cnblogs.com/huiandong/p/9973786.html

There is any way to run processes in the background?

一笑奈何 提交于 2019-12-05 06:27:17
问题 There is any command line or .NET method that runs a process in the background hiding any window it tries to open? Already tried: var process = new Process() { StartInfo = new ProcessStartInfo() { CreateNoWindow = true, WindowStyle = ProcessWindowStyle.Hidden, FileName = TheRealExecutableFileNameHere } } process.Start(); With no success so far 回答1: Check out the Matlab Engine. There's even an interesting article on CodeProject, if this approach fits your needs. 回答2: I reviewed my code and it

nohup error no such file or directory

放肆的年华 提交于 2019-12-05 06:01:26
I am trying to run a string of nohup commands to get server statistics. However I get an error of 'No such file or directory' . Note that the 3 nohup calls are embedded in a script which is executed through a cron job. And the first nohup works but the other 2 return an error. Ironically enough, when run on a different server, the script works fine. Commands nohup vmpstat -a -n 60 1000 > myvmstats (works) nohup mpstat -P ALL 1 1000 > mympstats (returns: nohup cannot run command mpstat : no such file or directory) nohup iostat -t -x 60 1000 >myiostats (returns: nohup cannot run command iostat :

starting remote script via ssh containing nohup

混江龙づ霸主 提交于 2019-12-05 05:46:09
I want to start a script remotely via ssh like this: ssh user@remote.org -t 'cd my/dir && ./myscript data my@email.com' The script does various things which work fine until it comes to a line with nohup: nohup time ./myprog $1 >my.log && mutt -a ${1%.*}/`basename $1` -a ${1%.*}/`basename ${1%.*}`.plt $2 < my.log 2>&1 & it is supposed to do start the program myprog, pipe its output to mylog and send an email with some datafiles created by myprog as attachment and the log as body. Though when the script reaches this line, ssh outputs: Connection to remote.org closed. What is the problem here?

How does nohup work? [closed]

前提是你 提交于 2019-12-05 04:27:04
Closed. This question is off-topic . It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . What is performed behind the scenes when a program runs with nohup? Is the PID of the parent process being changed? Thanks. EDIT : I understood that nohup (and disown) causes that SIGHUP is not sent to the process if the parent process receives it. Does it mean that it is equivalent to handling SIGHUP (and actually ignore it)? Use the source, Luke! (Extra characters added to keep the new answer length rules