newLISP Fan Club

Forum => newLISP and the O.S. => Topic started by: tomtoo on April 05, 2011, 09:00:51 AM

Title: file operations by process id
Post by: tomtoo on April 05, 2011, 09:00:51 AM
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?
Title: Re: file operations by process id
Post by: newdep on April 05, 2011, 12:12:35 PM
Quote from: "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?




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..
Title: Re: file operations by process id
Post by: tomtoo on April 05, 2011, 03:03:06 PM
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.



> (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.
Title: Re: file operations by process id
Post by: newdep on April 05, 2011, 04:02:53 PM
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...