我已运行程序几天将其输出重定向到日志文件,如下所示:
~$ myprog > LOG
错误地,我删除了LOG文件,我再也看不到LOG进度了。我已尝试使用
重新生成日志文件~$ touch LOG
然而它没有用。该程序仍在运行,并将再运行2天,因此仍有一些LOG值得一看。
有没有办法在这个问题下看到输出?
更新:这是lsof -p [pid]的输出。 LOG所在的文件夹是第一个条目/home/cristobal/potts_exacto/pfamilyd-1.0.0
cristobal@fdyn-1:~$ lsof -p 18510
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
pfamilyd- 18510 cristobal cwd DIR 8,6 0 8126487 /home/cristobal/potts_exacto/pfamilyd-1.0.0 (deleted)
pfamilyd- 18510 cristobal rtd DIR 8,5 4096 2 /
pfamilyd- 18510 cristobal txt REG 8,6 329460 8126501 /home/cristobal/potts_exacto/pfamilyd-1.0.0/bin/pfamilyd-1.0.0 (deleted)
pfamilyd- 18510 cristobal mem REG 8,5 67113040 6423790 /tmp/openmpi-sessions-cristobal@fdyn-1_0/3193/1/shared_mem_pool.fdyn-1
pfamilyd- 18510 cristobal mem REG 8,5 58296 3281676 /usr/lib/openmpi/lib/openmpi/mca_osc_rdma.so
pfamilyd- 18510 cristobal mem REG 8,5 50328 3281644 /usr/lib/openmpi/lib/openmpi/mca_osc_pt2pt.so
pfamilyd- 18510 cristobal mem REG 8,5 96656 3281624 /usr/lib/openmpi/lib/openmpi/mca_coll_tuned.so
pfamilyd- 18510 cristobal mem REG 8,5 14648 3281687 /usr/lib/openmpi/lib/openmpi/mca_coll_sync.so
pfamilyd- 18510 cristobal mem REG 8,5 23032 3281653 /usr/lib/openmpi/lib/openmpi/mca_coll_sm.so
pfamilyd- 18510 cristobal mem REG 8,5 10352 3281672 /usr/lib/openmpi/lib/openmpi/mca_coll_self.so
pfamilyd- 18510 cristobal mem REG 8,5 14448 3281648 /usr/lib/openmpi/lib/openmpi/mca_coll_inter.so
pfamilyd- 18510 cristobal mem REG 8,5 34960 3281659 /usr/lib/openmpi/lib/openmpi/mca_coll_basic.so
pfamilyd- 18510 cristobal mem REG 8,5 50360 3281631 /usr/lib/openmpi/lib/openmpi/mca_btl_tcp.so
pfamilyd- 18510 cristobal mem REG 8,5 29624 3281661 /usr/lib/openmpi/lib/openmpi/mca_btl_sm.so
pfamilyd- 18510 cristobal mem REG 8,5 16184 3281698 /usr/lib/openmpi/lib/openmpi/mca_btl_self.so
pfamilyd- 18510 cristobal mem REG 8,5 18960 3281651 /usr/lib/openmpi/lib/openmpi/mca_bml_r2.so
pfamilyd- 18510 cristobal mem REG 8,5 87416 3281695 /usr/lib/openmpi/lib/openmpi/mca_pml_ob1.so
pfamilyd- 18510 cristobal mem REG 8,5 23080 3281662 /usr/lib/openmpi/lib/openmpi/mca_dpm_orte.so
pfamilyd- 18510 cristobal mem REG 8,5 22800 3281703 /usr/lib/openmpi/lib/openmpi/mca_coll_hierarch.so
pfamilyd- 18510 cristobal mem REG 8,5 14688 3281674 /usr/lib/openmpi/lib/openmpi/mca_pubsub_orte.so
pfamilyd- 18510 cristobal mem REG 8,5 10464 3281379 /usr/lib/openmpi/lib/libmca_common_sm.so.2.0.0
pfamilyd- 18510 cristobal mem REG 8,5 10560 3281652 /usr/lib/openmpi/lib/openmpi/mca_mpool_sm.so
pfamilyd- 18510 cristobal mem REG 8,5 14632 3281665 /usr/lib/openmpi/lib/openmpi/mca_mpool_rdma.so
pfamilyd- 18510 cristobal mem REG 8,5 6248 3281658 /usr/lib/openmpi/lib/openmpi/mca_mpool_fake.so
pfamilyd- 18510 cristobal mem REG 8,5 14680 3281692 /usr/lib/openmpi/lib/openmpi/mca_rcache_vma.so
pfamilyd- 18510 cristobal mem REG 8,5 10456 3281634 /usr/lib/openmpi/lib/openmpi/mca_allocator_bucket.so
pfamilyd- 18510 cristobal mem REG 8,5 52120 1969739 /lib/x86_64-linux-gnu/libnss_files-2.15.so
pfamilyd- 18510 cristobal mem REG 8,5 47680 1969743 /lib/x86_64-linux-gnu/libnss_nis-2.15.so
pfamilyd- 18510 cristobal mem REG 8,5 97248 1969755 /lib/x86_64-linux-gnu/libnsl-2.15.so
pfamilyd- 18510 cristobal mem REG 8,5 35680 1969737 /lib/x86_64-linux-gnu/libnss_compat-2.15.so
pfamilyd- 18510 cristobal mem REG 8,5 18792 3281636 /usr/lib/openmpi/lib/openmpi/mca_grpcomm_bad.so
pfamilyd- 18510 cristobal mem REG 8,5 18928 3281680 /usr/lib/openmpi/lib/openmpi/mca_routed_binomial.so
pfamilyd- 18510 cristobal mem REG 8,5 66936 3281632 /usr/lib/openmpi/lib/openmpi/mca_oob_tcp.so
pfamilyd- 18510 cristobal mem REG 8,5 23544 3281668 /usr/lib/openmpi/lib/openmpi/mca_rml_oob.so
pfamilyd- 18510 cristobal mem REG 8,5 10552 3281649 /usr/lib/openmpi/lib/openmpi/mca_allocator_basic.so
pfamilyd- 18510 cristobal mem REG 8,5 14800 3281614 /usr/lib/openmpi/lib/openmpi/mca_ess_env.so
pfamilyd- 18510 cristobal mem REG 8,5 10624 3281682 /usr/lib/openmpi/lib/openmpi/mca_crs_none.so
pfamilyd- 18510 cristobal mem REG 8,5 6160 3281689 /usr/lib/openmpi/lib/openmpi/mca_carto_auto_detect.so
pfamilyd- 18510 cristobal mem REG 8,5 105288 1969740 /lib/x86_64-linux-gnu/libresolv-2.15.so
pfamilyd- 18510 cristobal mem REG 8,5 92720 1966309 /lib/x86_64-linux-gnu/libz.so.1.2.3.4
pfamilyd- 18510 cristobal mem REG 8,5 48248 1966115 /lib/x86_64-linux-gnu/libpci.so.3.1.8
pfamilyd- 18510 cristobal mem REG 8,5 43976 2889513 /usr/lib/libnuma.so.1
pfamilyd- 18510 cristobal mem REG 8,5 1421464 2893526 /usr/lib/x86_64-linux-gnu/libxml2.so.2.7.8
pfamilyd- 18510 cristobal mem REG 8,5 153424 2889517 /usr/lib/x86_64-linux-gnu/libhwloc.so.4.1.4
pfamilyd- 18510 cristobal mem REG 8,5 14736 3281693 /usr/lib/openmpi/lib/openmpi/mca_paffinity_hwloc.so
pfamilyd- 18510 cristobal mem REG 8,5 450520 2893570 /usr/lib/x86_64-linux-gnu/libgmp.so.10.0.2
pfamilyd- 18510 cristobal mem REG 8,5 39184 2889506 /usr/lib/x86_64-linux-gnu/libltdl.so.7.3.0
pfamilyd- 18510 cristobal mem REG 8,5 10632 1969734 /lib/x86_64-linux-gnu/libutil-2.15.so
pfamilyd- 18510 cristobal mem REG 8,5 1595096 2893433 /usr/lib/libcln.so.6.0.2
pfamilyd- 18510 cristobal mem REG 8,5 14768 1969750 /lib/x86_64-linux-gnu/libdl-2.15.so
pfamilyd- 18510 cristobal mem REG 8,5 1815224 1969735 /lib/x86_64-linux-gnu/libc-2.15.so
pfamilyd- 18510 cristobal mem REG 8,5 135366 1969744 /lib/x86_64-linux-gnu/libpthread-2.15.so
pfamilyd- 18510 cristobal mem REG 8,5 88384 1966124 /lib/x86_64-linux-gnu/libgcc_s.so.1
pfamilyd- 18510 cristobal mem REG 8,5 1030512 1969746 /lib/x86_64-linux-gnu/libm-2.15.so
pfamilyd- 18510 cristobal mem REG 8,5 962656 2888558 /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.16
pfamilyd- 18510 cristobal mem REG 8,5 1358656 3281445 /usr/lib/openmpi/lib/libmpi.so.1.0.2
pfamilyd- 18510 cristobal mem REG 8,5 106024 3281449 /usr/lib/openmpi/lib/libmpi_cxx.so.1.0.1
pfamilyd- 18510 cristobal mem REG 8,5 2826576 2896899 /usr/lib/libginac.so.2.1.0
pfamilyd- 18510 cristobal mem REG 8,5 149280 1969747 /lib/x86_64-linux-gnu/ld-2.15.so
pfamilyd- 18510 cristobal mem REG 8,5 296 6423791 /tmp/openmpi-sessions-cristobal@fdyn-1_0/3193/1/shared_mem_btl_module.fdyn-1
pfamilyd- 18510 cristobal 0r FIFO 0,8 0t0 64137792 pipe
pfamilyd- 18510 cristobal 1u CHR 136,2 0t0 5 /dev/pts/2
pfamilyd- 18510 cristobal 2w FIFO 0,8 0t0 64137793 pipe
pfamilyd- 18510 cristobal 3w CHR 5,0 0t0 1037 /dev/tty
pfamilyd- 18510 cristobal 4r DIR 8,5 4096 2 /
pfamilyd- 18510 cristobal 5u 0000 0,9 0 6115 anon_inode
pfamilyd- 18510 cristobal 6u unix 0x0000000000000000 0t0 64138322 socket
pfamilyd- 18510 cristobal 7u unix 0x0000000000000000 0t0 64138323 socket
pfamilyd- 18510 cristobal 8u IPv4 64138325 0t0 TCP *:35872 (LISTEN)
pfamilyd- 18510 cristobal 9u IPv4 64138328 0t0 TCP fdyn-1:60450->fdyn-1:37741 (ESTABLISHED)
pfamilyd- 18510 cristobal 10u IPv4 64138331 0t0 TCP *:1027 (LISTEN)
pfamilyd- 18510 cristobal 11w REG 8,6 5 8388683 /home/cristobal/lattices/kago_9xn/kago_9xn.slat.pfamily.mat.0
pfamilyd- 18510 cristobal 12u IPv4 64138332 0t0 TCP fdyn-1:33727->fdyn-2:1024 (ESTABLISHED)
pfamilyd- 18510 cristobal 13u IPv4 64138333 0t0 TCP fdyn-1:44117->fdyn-3:1028 (ESTABLISHED)
pfamilyd- 18510 cristobal 14u IPv4 64138334 0t0 TCP fdyn-1:1027->fdyn-2:52461 (ESTABLISHED)
pfamilyd- 18510 cristobal 15u IPv4 64138335 0t0 TCP fdyn-1:1027->fdyn-3:41435 (ESTABLISHED)
pfamilyd- 18510 cristobal 16u IPv4 64138336 0t0 TCP fdyn-1:1027->fdyn-3:41436 (ESTABLISHED)
pfamilyd- 18510 cristobal 17u IPv4 64138337 0t0 TCP fdyn-1:1027->fdyn-4:57026 (ESTABLISHED)
pfamilyd- 18510 cristobal 18u IPv4 64138338 0t0 TCP fdyn-1:1027->fdyn-3:41438 (ESTABLISHED)
pfamilyd- 18510 cristobal 19u IPv4 64138339 0t0 TCP fdyn-1:1027->fdyn-4:57027 (ESTABLISHED)
pfamilyd- 18510 cristobal 20u IPv4 64138340 0t0 TCP fdyn-1:1027->fdyn-4:57029 (ESTABLISHED)
pfamilyd- 18510 cristobal 21u IPv4 64138341 0t0 TCP fdyn-1:1027->fdyn-4:57030 (ESTABLISHED)
pfamilyd- 18510 cristobal 22u IPv4 64138342 0t0 TCP fdyn-1:1027->fdyn-3:41439 (ESTABLISHED)
pfamilyd- 18510 cristobal 23u IPv4 64138343 0t0 TCP fdyn-1:1027->fdyn-4:57032 (ESTABLISHED)
pfamilyd- 18510 cristobal 24u IPv4 64138344 0t0 TCP fdyn-1:1027->fdyn-4:57033 (ESTABLISHED)
pfamilyd- 18510 cristobal 25w FIFO 0,8 0t0 64137794 pipe
pfamilyd- 18510 cristobal 26u IPv4 64138345 0t0 TCP fdyn-1:1027->fdyn-2:52462 (ESTABLISHED)
pfamilyd- 18510 cristobal 27u IPv4 64138346 0t0 TCP fdyn-1:1027->fdyn-2:52463 (ESTABLISHED)
pfamilyd- 18510 cristobal 28u IPv4 64138347 0t0 TCP fdyn-1:1027->fdyn-2:52464 (ESTABLISHED)
pfamilyd- 18510 cristobal 29u IPv4 64138348 0t0 TCP fdyn-1:1027->fdyn-4:57034 (ESTABLISHED)
pfamilyd- 18510 cristobal 30u IPv4 64138349 0t0 TCP fdyn-1:1027->fdyn-2:52465 (ESTABLISHED)
pfamilyd- 18510 cristobal 31u IPv4 64138350 0t0 TCP fdyn-1:1027->fdyn-3:41440 (ESTABLISHED)
pfamilyd- 18510 cristobal 32u IPv4 64138351 0t0 TCP fdyn-1:1027->fdyn-3:41441 (ESTABLISHED)
pfamilyd- 18510 cristobal 33u IPv4 64138352 0t0 TCP fdyn-1:1027->fdyn-3:41442 (ESTABLISHED)
pfamilyd- 18510 cristobal 34u IPv4 64138353 0t0 TCP fdyn-1:1027->fdyn-2:52466 (ESTABLISHED)
pfamilyd- 18510 cristobal 35u IPv4 64138354 0t0 TCP fdyn-1:1027->fdyn-4:57035 (ESTABLISHED)
pfamilyd- 18510 cristobal 36u IPv4 64138356 0t0 TCP fdyn-1:1027->fdyn-2:52467 (ESTABLISHED)
其他信息:我不确定这是否会改变这种情况。但该程序是一个MPI程序(32个进程,因此有31个其他PID,其数量接近18510,这是我监控的一个),当前正在屏幕会话上运行。从开始到我如何删除文件的事件过程如下:
~$ cd path_to_pfamilyd-1.0.0
~$ screen -S my_screen_session
~$ mpirun -np 32 ./myprog [args] > LOG
~$ Crtl + A + D
~$ some days layer, by mistake i did: rm -r path_to_pfamilyd-1.0.0, and installed another version.
~$ program is still running...
答案 0 :(得分:2)
简单的解决方案:
lsof -p [pid]
查找进程已打开的文件。确定您感兴趣的文件的fd。tail -f /proc/[pid]/fd/[file-descriptor]
其中[file-descriptor]
是您在步骤1中确定的那个。答案 1 :(得分:-4)
请检查您在bash脚本中提供的路径。通常'>'重定向符号具有多个功能,也可用于创建新文件。意外地,如果您删除了文件,则会在下一次运行时在脚本中再次创建它,因为有适当的权限。但是在删除之前,您将无法恢复旧日志。新日志将出现在新创建的日志文件中。
您可以使用追加重定向'>>'而不是直接重定向,以防止以前的数据丢失,因为'>'每次运行脚本时都会截断旧文件。
如果您错过了日志文件路径,您也可以使用其他搜索命令,例如locate,find等给出日期时间标准。
还尝试添加“> / dev / null 2>& 1&”对于crontab中命令脚本末尾的备份日志进度,如果在特定时间安排。