打开现有流程

发布于 2024-08-24 14:29:11 字数 1832 浏览 2 评论 0原文

我通过远程连接 (xrdp) 在 Linux 中使用 Eclipse。我的互联网断开了,所以在 eclipse 运行时我与服务器断开了连接。

现在我再次登录,并执行“top”命令,我可以看到 eclipse 正在运行并且仍在我的用户名下。

有什么方法可以让我重新看到这个进程(我不想杀死它,因为我正在检查大量代码)?再次登录后,它没有显示在底部面板上。

这是“顶部”输出:

/home/mclouti% top
top - 08:32:31 up 43 days, 13:06, 29 users,  load average: 0.56, 0.79, 0.82
Tasks: 447 total,   1 running, 446 sleeping,   0 stopped,   0 zombie
Cpu(s):  6.0%us,  0.7%sy,  0.0%ni, 92.1%id,  1.1%wa,  0.1%hi,  0.1%si,  0.0%st
Mem:   3107364k total,  2975852k used,   131512k free,    35756k buffers
Swap:  2031608k total,    59860k used,  1971748k free,   817816k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
13415 mclouti   15   0  964m 333m  31m S 21.2 11.0  83:12.96 eclipse
16040 mclouti   15   0  2608 1348  888 R  0.7  0.0   0:00.12 top
31395 mclouti   15   0 29072  20m 8524 S  0.7  0.7 611:08.08 Xvnc
 2583 root      20   0  898m 2652 1056 S  0.3  0.1 139:26.82 automount
28990 postgres  15   0 13564  868  304 S  0.3  0.0  26:33.36 postgres
28995 postgres  16   0 13808 1248  300 S  0.3  0.0   6:54.95 postgres
31440 mclouti   15   0  3072 1592 1036 S  0.3  0.1   6:01.54 gam_server
    1 root      15   0  2072  524  496 S  0.0  0.0   0:03.00 init
    2 root      RT  -5     0    0    0 S  0.0  0.0   0:04.53 migration/0
    3 root      34  19     0    0    0 S  0.0  0.0   0:00.04 ksoftirqd/0
    4 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/0
    5 root      RT  -5     0    0    0 S  0.0  0.0   0:01.72 migration/1
    6 root      34  19     0    0    0 S  0.0  0.0   0:00.07 ksoftirqd/1
    7 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/1
    8 root      RT  -5     0    0    0 S  0.0  0.0   0:04.33 migration/2
    9 root      34  19     0    0    0 S  0.0  0.0   0:00.05 ksoftirqd/2

I am using Eclipse in Linux through a remote connection (xrdp). My internet got disconnected, so I got disconnected from the server while eclipse was running.

Now I logged in again, and I do the "top" command I can see that eclipse is running and still under my user name.

Is there some way I can bring that process back into my view (I do not want to kill it because I am in the middle of checking in a large swath of code)? It doesnt show up on the bottom panel after I logged in again.

Here is the "top" output:

/home/mclouti% top
top - 08:32:31 up 43 days, 13:06, 29 users,  load average: 0.56, 0.79, 0.82
Tasks: 447 total,   1 running, 446 sleeping,   0 stopped,   0 zombie
Cpu(s):  6.0%us,  0.7%sy,  0.0%ni, 92.1%id,  1.1%wa,  0.1%hi,  0.1%si,  0.0%st
Mem:   3107364k total,  2975852k used,   131512k free,    35756k buffers
Swap:  2031608k total,    59860k used,  1971748k free,   817816k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
13415 mclouti   15   0  964m 333m  31m S 21.2 11.0  83:12.96 eclipse
16040 mclouti   15   0  2608 1348  888 R  0.7  0.0   0:00.12 top
31395 mclouti   15   0 29072  20m 8524 S  0.7  0.7 611:08.08 Xvnc
 2583 root      20   0  898m 2652 1056 S  0.3  0.1 139:26.82 automount
28990 postgres  15   0 13564  868  304 S  0.3  0.0  26:33.36 postgres
28995 postgres  16   0 13808 1248  300 S  0.3  0.0   6:54.95 postgres
31440 mclouti   15   0  3072 1592 1036 S  0.3  0.1   6:01.54 gam_server
    1 root      15   0  2072  524  496 S  0.0  0.0   0:03.00 init
    2 root      RT  -5     0    0    0 S  0.0  0.0   0:04.53 migration/0
    3 root      34  19     0    0    0 S  0.0  0.0   0:00.04 ksoftirqd/0
    4 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/0
    5 root      RT  -5     0    0    0 S  0.0  0.0   0:01.72 migration/1
    6 root      34  19     0    0    0 S  0.0  0.0   0:00.07 ksoftirqd/1
    7 root      RT  -5     0    0    0 S  0.0  0.0   0:00.00 watchdog/1
    8 root      RT  -5     0    0    0 S  0.0  0.0   0:04.33 migration/2
    9 root      34  19     0    0    0 S  0.0  0.0   0:00.05 ksoftirqd/2

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

土豪 2024-08-31 14:29:11

这是一个漫长的过程,但你可以尝试这个小程序 此线程

#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>

int main(int argc, char **argv)
{
if ( argc != 2 ) {
printf("Usage:\n\ttotop <window id>\n");
return 1;
}

Display *dsp = XOpenDisplay(NULL);

long id = strtol(argv[1], NULL, 16);
XRaiseWindow ( dsp, id );
XSetInputFocus ( dsp, id, RevertToNone, CurrentTime );

XCloseDisplay ( dsp );

return 0;
}

您可以使用以下命令进行编译:

$ c++ totop.cpp -L/usr/X11R6/lib -lX11 -o totop

我假设您将其保存在“totop.cpp”中。

有问题,我不知道如何解决:
如果窗口位于另一个虚拟桌面中,则该程序无法运行。
这里又出现了一个问题:如何将窗口发送到当前桌面?

您可以使用xwininfo获取窗口ID。
使用此程序的一个小脚本用于调用 Eclipse:

#!/bin/bash
if ps -A | grep eclipse; then # if Eclipse already launched
  id=$(xwininfo -name "Eclipse" | grep id: | awk "{ print \$4 }")
  totop $id
else # launch Eclipse
  eclipse
fi

It is a long shot, but you could try this little program from this thread

#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>

int main(int argc, char **argv)
{
if ( argc != 2 ) {
printf("Usage:\n\ttotop <window id>\n");
return 1;
}

Display *dsp = XOpenDisplay(NULL);

long id = strtol(argv[1], NULL, 16);
XRaiseWindow ( dsp, id );
XSetInputFocus ( dsp, id, RevertToNone, CurrentTime );

XCloseDisplay ( dsp );

return 0;
}

You can compile it with:

$ c++ totop.cpp -L/usr/X11R6/lib -lX11 -o totop

I assumed that you saved it in "totop.cpp".

It has problem I do not know how to fix:
if window is in another virtual desktop this program doesn't work.
Here another question rises: how to send window to current desktop?

You can get window id using xwininfo.
A little script using this program used to call Eclipse:

#!/bin/bash
if ps -A | grep eclipse; then # if Eclipse already launched
  id=$(xwininfo -name "Eclipse" | grep id: | awk "{ print \$4 }")
  totop $id
else # launch Eclipse
  eclipse
fi
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文