Tagged Questions
0
votes
0answers
41 views
How to echo to running process in shell? [migrated]
If I have a C++ program that expects input to cin from the console during run-time, how can I automate this input from a shell script? I also need to store its output in a file but that part is easy. ...
1
vote
1answer
95 views
Is there a way to see which process invoked a shell script?
Is there a possibility so see from some unix log file what process have invoked a bash/ksh shell script or is this shell script invoked manually from command line? So is there some log file which ...
2
votes
5answers
148 views
Is there a way to listen to process?
I want to know if there is a way to listen to a process in linux & unix - when it ends and what's the exit code of the process(script).
I dont want to write a script that will run X seconds and ...
4
votes
3answers
184 views
Terminating a bash shell script running in the background
I often use bash shell scripts to run simple commands for many different files. For example, suppose that I have the following bash shell script, called script.sh, that runs the program/command foo ...
2
votes
1answer
141 views
How to check if a currently running process is opened by root or user
I'm currently creating a BASH script to kill off processes. I first check if the process is running then kill it. But I would like to add a nested if to find out if that process was opened by root ...
0
votes
2answers
270 views
`ps | grep | kill` aborts my script prematurely [duplicate]
I have a Linux computer that I remotely SSH into using plink on a Windows XP machine. I have the Plink program set to execute commands in a script using automated login:
plink -ssh [domain name] -l ...
3
votes
3answers
102 views
Print process ID (PID) of a Matlab instance
To run my Matlab scripts, I've created a shell script to which I give two parameters - the path to the matlab file ($1) and to the log file ($2):
nohup time matlab -some_parameters -r "run $1;exit" ...
1
vote
2answers
383 views
multiple background processes in a script
Suppose if i have a situation in which some files need to be copied and it takes long time so
i would have to go for parallel processing of the file copy.
for example it may look like this
for i in ...
4
votes
3answers
521 views
How to poll existence of a background script correctly
I have a problem with the following kind of script:
#!/bin/sh
long_running_script.sh &
while [ `pidof long_running_script.sh` ]
do
echo "."
sleep 1
done
The sript will ...
1
vote
1answer
407 views
How to preload my .so everytime an application executes?
I've successfully used a hook under linux with this article: http://hackerboss.com/overriding-system-functions-for-fun-and-profit/
Now I want to make my .so file load every time espeak loads up. No ...
5
votes
3answers
833 views
killing processes automatically
I need to kill all processs in a certain shell excluding certain processes.
Like sh which is my shell. And the comand.
This is what currently in my shell right now.
rcihp146 :/home/msingh2> ps
...
3
votes
3answers
362 views
What's the best way to determine the working directory for UNIX process using 'ps'?
I am running a Ruby command line script (rufus.sh)which ultimately calls Thread.new, which spawns a UNIX process as shown below. I run this script for more than 1 directory as the output of the ps ...
4
votes
3answers
1k views
How to kill two or more processes with one kill command?
I am using the following command to kill one java process via shell script:
pidof java|xargs kill -9 $1
What if the list of pidof output has more than one elements? How do I kill them both with ...