Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to run conky with gksudo (to get top amongst all process, not just mine) but I have really strange issue. Despite the fact that conky forks itself and exit immediately, gksudo won't exit at the same time. If I close it with Ctrl+C conky continue to run which proves that it had forked successfully. How can I make gksudo see that process it started has ended and give me my shell back?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

When conky forks itself and exits, the parent process that gksudo created will continue to hang around as a zombie process.

On Unix and Unix-like computer operating systems, a zombie process or defunct process is a process that has completed execution but still has an entry in the process table. This entry is still needed to allow the process that started the (now zombie) process to read its exit status. The term zombie process derives from the common definition of zombie—an undead person. In the term's colorful metaphor, the child process has died but has not yet been reaped.

As long as this process is present, gksudo will continue to run. From its man page:

Upon successful execution of a program, the return value from sudo will simply be the return value of the program that was executed.

If you're running this interactively, run it in the background as suggested, and for non-interactive use, give root permission to conky or the wrapper script via the /etc/sudoers file.

Edit: Using the gvim example in the other answer:

$ #gksudo running
$ ps -ef | grep gvim
171:nagul    22876  9378  0 12:18 pts/1    00:00:00 gksudo gvim
172:root     22877 22876  0 12:18 ?        00:00:00 [gvim] <defunct>
176:root     22892     1  0 12:18 ?        00:00:00 gvim

$ #gksudo killed via Ctrl-C
$ ps -ef | grep gvim
174:root     22892     1  0 12:18 ?        00:00:00 gvim
share|improve this answer
add comment

It seems to me that gksudo never does that. For example, gvim will give you a working shell back when you started it. But starting it with gksudo will block the shell.

The easiest thing you can do is run it in the background:

gksudo conky &
share|improve this answer
    
This doesn't work. @nagul is probably right and it just waits for exit code. –  vava Aug 30 '09 at 12:13
    
Strange. It works for me. –  innaM Aug 31 '09 at 8:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.