用 putty 连接 Ubuntu 运行脚本,但是断开连接爬虫就退出,不能一直在后台执行。
搜了解决方法在命令前后加以下代码:
nohup python smzdm.py &
但是报错,哪里写错了么?
1
reeco 2016-06-10 19:33:03 +08:00 via iPhone 1
screen
|
2
notgod 2016-06-10 19:35:34 +08:00 1
|
3
ug888168 2016-06-10 19:38:59 +08:00 via Android 1
screen 应该能帮你
|
4
mornlight 2016-06-10 19:40:57 +08:00 1
建议上 supervisor ,你这种需求写一下文件路径就行,很简单
|
10
GhostEX OP ```python
root@iZu1imazcmtZ:/# jobs [1] Running nohup python smzdm.py & (wd: /var/www) [2] Running nohup python smzdm.py & (wd: /var/www) [3] Running nohup python smzdm.py & (wd: /var/www) [4] Running nohup python smzdm.py & (wd: /var/www) [5] Running nohup python smzdm.py & (wd: /var/www) [6] Running nohup python smzdm.py & (wd: /var/www) [7] Running nohup python smzdm.py & (wd: /var/www) [8] Running nohup python smzdm.py & (wd: /var/www) [9] Running nohup python smzdm.py & (wd: /var/www) [10] Running nohup python smzdm.py > out.log & (wd: /var/www) [11] Running nohup python -u smzdm.py > out.log & (wd: /var/www) [12] Running nohup python smzdm.py & (wd: /var/www) [13] Running nohup python /var/www/smzdm.py > _log.txt 2>&1 & (wd: /var/www) [14] Running nohup python /var/www/smzdm.py > _log.txt & (wd: /var/www) [16] Running nohup python /var/www/smzdm.py > _log.txt & (wd: /var/www) [17] Running nohup python smzdm.py > _log.txt & (wd: /var/www) [18] Running nohup python /var/www/smzdm.py > _log.txt 2>&1 & [19] Running nohup python /var/www/smzdm.py > _log.txt 2>&1 & [20]- Running nohup python /var/www/smzdm.py > _log.txt 2>&1 & [21]+ Running nohup python /var/www/smzdm.py > _log.txt 2>&1 & root@iZu1imazcmtZ:/# ``` 是该理解成是 21 个进程么? |
11
spikeLIN 2016-06-10 20:21:23 +08:00 via iPhone
直接上定时也行⋯⋯
|
12
RockyLee 2016-06-10 21:20:27 +08:00
screen 时间久了也会挂掉的
|
13
ThreeBody 2016-06-10 22:12:26 +08:00 via Android 1
@RockyLee screen 会挂么?我好像没遇到过,不过以前遇到过 screen 被挂起的问题,进不去,不过用-D 参数就可以进去了,不知道你说的是不是这个情况
|
14
sen506 2016-06-10 23:00:45 +08:00 via Android
tmux ?或者不要后台一直运行,改成定时的?
|
15
prondtoo 2016-06-10 23:02:09 +08:00
supervisor
|
17
sciooga 2016-06-11 02:06:38 +08:00
daemon ?
|
18
exuxu 2016-06-11 10:27:39 +08:00
tmux +2
|