Comments (7)
There's no way to kill individual commands, as there's no way to send the signal (without opening a secondary shell).
You could have a secondary shell open (the entire time) and send kill commands through that.
Or you could start inotifywait -m &
so the inotify process is run async, and you can issue the kill command through the primary shell.
It's just shell coding, be creative.
from libsuperuser.
Thanks for the feedback. I will play around with opening a secondary shell or just use the recursive flag for inotifywait. :)
from libsuperuser.
On Apr 1, 2015 7:59 AM, "Jared Rummler" [email protected] wrote:
Thanks for the feedback. I will play around with opening a secondary
shell or just use the recursive flag for inotifywait. :)—
Reply to this email directly or view it on GitHub.
from libsuperuser.
Thank you so so much
On Apr 1, 2015 7:59 AM, "Jared Rummler" [email protected] wrote:
Thanks for the feedback. I will play around with opening a secondary
shell or just use the recursive flag for inotifywait. :)—
Reply to this email directly or view it on GitHub.
from libsuperuser.
Thank yoi
On Apr 1, 2015 7:59 AM, "Jared Rummler" [email protected] wrote:
Thanks for the feedback. I will play around with opening a secondary shell
or just use the recursive flag for inotifywait. :)—
Reply to this email directly or view it on GitHub
#34 (comment)
.
from libsuperuser.
Okay, so I think killing the command in another shell is the way to go. However, I am trying to find the best way to get the PID for the command.
I am getting the PID of the process using this static factory method I wrote:
public static int getPid(Process process) {
try {
Class<?> ProcessImpl = process.getClass();
Field field = ProcessImpl.getDeclaredField("pid");
field.setAccessible(true);
return field.getInt(process);
} catch (NoSuchFieldException | IllegalAccessException | IllegalArgumentException e) {
return -1;
}
}
This returns the PID for the shell and not the command. Example: got 25396
and ran ps | grep 25396
:
u0_a153 25396 25366 3188 364 c0275ca8 b6f8bb68 S su
Do you know how I can get the PID of the command? I guess I can parse the output of ps
. For example: running the following command gives me the PID I'm looking for:
ps | grep inotifywait
root 25408 25404 3168 820 c0275ca8 b6ea4b68 S /data/data/com.jrummyapps.rootbrowser/files/inotifywait/armeabi-v7a/inotifywait
This approach is not desirable because multiple inotifywait processes could be running.
Do you know of a better approach to getting the PID for the command and not the shell?
from libsuperuser.
Got it working. You can close this.
from libsuperuser.
Related Issues (20)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libsuperuser.