file operations by process id

Machine-specific discussion
Unix, Linux, OS X, OS/2, Windows, ..?
Locked
tomtoo
Posts: 46
Joined: Wed Oct 28, 2009 10:00 pm

file operations by process id

Post by tomtoo »

Hey guys,

This is for Linux.

I use rox panels along the edges of my screen, and to save space I'd like to toggle them on and off. to open a panel I use, for instance,

$ rox --top=panel-name

to kill the panel,

$ rox --top=


I wrote something that calls "ps aux" and it will only kill the process, but not start it up again. I'd also like to have a newlisp-only solution. Newlisp can do it; I can't. Help?

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Re: file operations by process id

Post by newdep »

tomtoo wrote:Hey guys,

This is for Linux.

I use rox panels along the edges of my screen, and to save space I'd like to toggle them on and off. to open a panel I use, for instance,

$ rox --top=panel-name

to kill the panel,

$ rox --top=


I wrote something that calls "ps aux" and it will only kill the process, but not start it up again. I'd also like to have a newlisp-only solution. Newlisp can do it; I can't. Help?

Hi.. I dont know what rox panels are but if you are able to control them from a unix shell
then you can without problems do it from newlisp.. But i dont understand your question,
perhpas you can explain it again?

If you want to use shell access from within newlisp look at "!" "process" "exec" and "pipe" and you should be fine..
-- (define? (Cornflakes))

tomtoo
Posts: 46
Joined: Wed Oct 28, 2009 10:00 pm

Re: file operations by process id

Post by tomtoo »

Rox is a file manager that you can configure to have panels along your screen's edge displaying directories or binaries or scripts.

I know one reason I'm having problems: /usr/bin/rox is itself a shell script, and the pid resulting from running "rox --panel=mypanel" is not the pid of the actual panel.

Code: Select all

> (process "/usr/bin/rox --top=top-panel")
5002
> (destroy 5002)
nil
> (process "/usr/bin/rox --right=right-panel")
5006
> (destroy 5006)
nil
I can run
/usr/share/Rox-Filer/AppRun --top=top-panel
directly from a terminal and it starts as expected, but not from newlisp with process. I'm sure I'm just missing something obvious.

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Re: file operations by process id

Post by newdep »

aha oke.. yes i think the script that executes the rox is causing the confusion of what pid is actualy leading.

If you have access to the rox script you could add a small line to the script , or the execute of the tables
that logs the pid (in bash you can use the $$ for this) and redirect it to a file ie.e. in .var.tmp/rox1.pid
then from newlisp you can read that file and kill the pid id from it.

On the other hand i think you might need to scan the unix processes because newlisp doesnt know whats executed ofcourse. What i normaly use is the "ps" command with some extra's.. you can i.e.
use the "ps -eo pid,comm" to see all prosesses with their args.. (setq result (exec "ps -eo pid,comm"))
now you can manipuate that result to get to the pid of the right rox applet.. Hope it helps...
-- (define? (Cornflakes))

Locked