Как закрыть wicd gui, не выходя из свисающего процесса

824
nullUser

Если я открою графический интерфейс wicd с помощью wicd-gtk &, его закрытие (даже с помощью кнопки «Выход») может закрыть графический интерфейс, но всегда оставляет процесс, wicd-clientработающий в фоновом режиме, по-видимому, ничего не делающий. Я заметил это, потому что я проверил свои запущенные процессы после 20 дней безотказной работы, чтобы найти только 15 wicd-clientс. К вашему сведению, я работаю с Debian, Джесси.

Почему эти процессы не умирают с графическим интерфейсом и как я могу это исправить?

Я заметил, что если я запускаю клиент без его фоновой обработки (т.е. просто с помощью команды wicd-gtk), когда я закрываю графический интерфейс, терминал все еще зависает, пока я не нажму CTRL-C. При нажатии CTRL-C wicd-clientпроцесс закрывается.

1

3 ответа на вопрос

1
blanket_cat

I still have the same problem with wicd. The underlying problem, is that when you start wicd, it launches separate processes to handle whatever it needs to handle that's not your input. These processes interact but are not one process, the GUI is one process, the monitor is one process, the daemon is also it's own process. You can see below that it is not one program being launched in the traditional sense, but three or four python scripts launched by separate python interpreters.

If you open a terminal examine it with top -c (the show command option) you'll find the processes running are:

/usr/bin/python -O /usr/share/wicd/daemon/monitor.py /usr/bin/python -O /usr/share/wicd/daemon/wicd-daemon.py /usr/bin/python -O /usr/share/wicd/gtk/wicd-client.py 

Now I'm running ubuntu, which is a debian variant, but the process that works for me should probably work for you with no or little adjustment.

1st, get the pids with ps aux | grep wicd

2nd, run kill and the pids of the processes.

OR

if you have no other python interpreters open running processes you can get them all at once with

kill $(pidof python) 
Спасибо @DavidPostill, это ваш способ сказать, что мой ответ отформатирован неправильно? blanket_cat 9 лет назад 0
Ха! хорошо спасибо. Я не привыкла к тому, что в Интернете люди очень милые. blanket_cat 9 лет назад 0
Меня больше интересует автоматическое решение. Я не хочу помнить, чтобы убивать эти процессы каждый раз, когда я закрываю WICD. Это действительно дизайн, который задумывали авторы? nullUser 9 лет назад 1
Лучшее решение, которое я могу придумать, - это взять что-то вроде структуры while, описанной здесь в решении, и настроить ее на ожидание смерти вашего графического интерфейса, а затем добавить строку, которая инструктирует скрипт для уничтожения оставшихся процессов, если GUI больше не жив. http://stackoverflow.com/questions/1058047/wait-for-any-process-to-finish blanket_cat 9 лет назад 0
1
insignificant zebra

wicd-gtkЗависает, когда его окно закрыто, если оно не вызывается как wicd-gtk --no-trayили wicd-client --no-tray(без wicd-cursesустановленного, wicd-clientвызывает wicd-gtk).

Быстрое решение состоит в том, чтобы поместить что-то подобное в ваш PATH или профиль оболочки, который заменяется wicd-gtkна wicd-gtk --no-tray.

Для пользователей, которые не хотят запускать клиент в фоновом режиме или использовать опасаемый wicd-cursesклиент, это, к сожалению, невозможно настроить без параметра командной строки; wicd-client.pyнужно будет залатать. Патч может быть проверкой существующего процесса, а затем вызывать окно GTK, присоединенное к этому процессу, вместо запуска.

-1
Lithopsian

You don't say whether you're running wicd-gtk or wicd-curses? It sounds like GTK since you mention "button".

wicd-gtk is a single process (Python session). Sorry to knotech, but you're just wrong. There are daemon and monitor processes, but they are supposed to remain running at all times and it is extremely unlikely that there will be multiple copies, and they won't be called wicd-client. Just for completeness, the daemon (and monitor) can be started by running wicd-client, but this will only happen if they aren't already running and only after you enter your gksudo password. If you kill the daemon then your networks will no longer be managed, they won't automatically (re-)connect, and you may be left without a connection.

So wicd-gtk starts one or both, or neither, of a window and a tray icon. Typing just wicd-gtk (or typing wicd-client which will run your installed type of wicd client) should start both. wicd-gtk --tray will start just the tray, wicd-gtk --no-tray just the window. wicd-gtk --only-notifications will start neither, just spawning a process which can give you notification bubbles when your networks are connected or disconnected.

Pressing the Quit button in the window closes the window. It does not close the tray icon, so if you started with just wicd-gtk (or wicd-gtk --tray and later opened the window) then you will be left with a tray icon. This is known as "close to tray" behaviour and is very common, although it might be nicer for some people if it could be configured not to do it. If you started with wicd-gtk --no-tray then the whole thing will close when you press the Quit button. If you do have a tray icon (do you?) then you can close the whole thing from the tray icon context menu. Or with ctrl-C from wherever you started it.

If you don't have a tray icon and don't want one then start with wicd-gtk --no-tray. Then your client will close when you press the Quit button. If you want a tray icon but want the whole thing to go away when you press the Quit button in the window then at the moment you're out of luck.

`wicd-client` будет запускать процессы` wicd-gtk` БЕЗ запроса на повышение уровня `gksudo` в некоторых дистрибутивах, таких как Debian. Почему «крайне маловероятно» будет несколько копий `wicd-gtk`, если он вызывается и закрывается несколько раз? Начиная с версии 1.7.2.4 не видно, что приложение останавливает себя или существующие процессы при запуске. Также согласно `man (8) wicd`, переподключение должно быть выполнено с помощью wicd-daemon.py. insignificant zebra 8 лет назад 0

Похожие вопросы