Tagged Questions
3
votes
3answers
35 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" ...
4
votes
1answer
41 views
Suspend and edit previous single line commands
Say I want to modify the latter of some concatenated command line options, is it possible without killing the first command?
Specifically I have compile and run scripts executed thusly:
> compile ...
0
votes
0answers
29 views
Pass process ownership to another shell [duplicate]
I didn't hear of anything like this, but It might be possible.
I often end up starting a process on a server and midway realizing that I would like to suspend that process and continue it inside a ...
1
vote
1answer
61 views
What rules govern the parent-child relationship of processes launched by shell across a pipe?
#!/bin/ksh
# start_service: start the service
my_server_executable 2>&1 | my_pipe_following_shell_script &
exit 0
After I run the above start_service script from command line, it is ...
3
votes
3answers
165 views
Running multiple nohup commands in background
Got two commands cmd1 and cmd2. Of the two, cmd2 takes longer to finish. Need to run cmd2 and then cmd1.
Tried to run them in following way:
bash$ (nohup ./cmd2>result2 &) && nohup ...
1
vote
2answers
70 views
Cron creates vim process but does not display vim
Under MacOSX 10.8.2 I am able to run vim as follows in the bash shell:
/usr/bin/vim -c "normal G" -c 'startinsert' ~/.journal
If I put the exact same command in a script:
#! /bin/bash
export ...
2
votes
2answers
90 views
$BASHPID And $$ differ in some cases
I'm reading "BASH pocket guide of Oreilly".
It said:
The process ID of the current Bash process.
In some cases, this can differ from $$.
Above explanation , explained $BASHPID variable.
...
3
votes
1answer
70 views
Can I add to my groups in the current (shell) process?
If I add myself to a group, it applies only to newly launched processes. Actually it's more restricted than that; it seems to apply only to new logins. I'm not sure what the exact mechanism is, but ...
2
votes
1answer
99 views
Can I transfer running process from dead ssh [duplicate]
Possible Duplicate:
How can I disown a running process and associate it to a new screen shell?
I have started (as expected) a long copy process from ssh shell (putty) which died due to ...
6
votes
1answer
142 views
What should interactive shells do in orphaned process groups?
(Re-posting in unix per the suggestion in http://stackoverflow.com/questions/13718394/what-should-interactive-shells-do-in-orphaned-process-groups)
The short question is, what should a shell do if it ...
18
votes
4answers
738 views
What's the difference between running a program as a daemon and forking it into background with '&'?
What are the practical differences from a sysadmin point of view when deploying services on a unix based system?
1
vote
2answers
143 views
How to run linux process and come back to it later?
I'm trying to run a minecraft server on linux. Running the server starts an important interactive session. I can run the server in the background by appending & at the end of the command and log ...
12
votes
4answers
493 views
Is there a program that can send me a notification e-mail when a process finishes?
I am a computational scientist, and I run a lot of lengthy calculations on Linux. Specifically, I run molecular dynamics (MD) simulations using the GROMACS package. These simulations can take days ...
3
votes
3answers
141 views
“Virtual” shell, ie. jailing an user inside a process
The title might not say much about the issue at hand so let me get straight to the point.
Let's assume I have a casual user who can log in to the system via SSH into a bash shell. I also have a PHP ...
1
vote
1answer
211 views
Korn shell timeout/kill script
I am trying to write a simple Korn shell script to execute a loading process. The process occasionally runs into connectivity issues, so I need to kill it if it runs too long.
I have been trying the ...
3
votes
1answer
182 views
wait does not wait
If i have a file called myprogram containing
sleep 200
date
Run this in the background:
$ sh myprogram &
i want to know when myprogram has completed by using wait command
$ cat >notify
...
3
votes
1answer
1k views
How to see how many context switches a process makes?
I want to see if my process makes a lot of context switches. I also want to see how manpulating task groups affects the number of context switches.
1
vote
2answers
362 views
Kill all processes related to an application
I have two processes that are temporarily spawned and I need to kill them. Here are the processes from ps aux
david 38329 0.0 5.0 3916476 104624 s002 S 11:33AM 0:17.43 ...
1
vote
2answers
655 views
How to pass data outside process for zenity progress?
Usually this would be a question about how to pass data from a subprocess to a main process, but maybe zenity has some extra quirks so please focus on zenity.
Example:
#!/bin/sh
(
echo "10" ; sleep ...
8
votes
4answers
3k views
How to attach terminal to detached process?
I have detached a process from my terminal, like this:
$ process &
That terminal is now long closed, but process is still running and I want to send some commands to that process's stdin. Is ...
4
votes
3answers
325 views
What is a subshell (in the context of the documentation of make)?
I'm reading a book about the make command and there is a paragraph:
If any of the prerequisites has an associated rule, make attempts to
update those first. Next, the target file is considered. ...
7
votes
3answers
572 views
How to stop a bunch of processes on unix fast?
How to stop a bunch of processes on unix fast.
I can use ps/top, kill.
If the number of processes is very large, I use shell script.
Are there other ways, only one or two unix commands can do it ...
2
votes
1answer
430 views
using pidof with sh -c
I was wondering why this command line does not print pidof sh
$ sh -c "var=`pidof sh` ; echo \$var; ps -H"
This one prints 123 as expected
$ sh -c "var=123 ; echo \$var; ps -H"
I am on ubuntu ...
3
votes
3answers
201 views
Kill process when it stops to produce further output
Is there a shell tool which can probe if a subprocess is still producing output, and otherwise kill it after a specified timeout?
I'm using offlineimap for Gmail backup, but that's very very very ...
2
votes
4answers
4k views
What is a command line alternative to top for finding current CPU utilization that isn't dependent on screen width?
If I run top -p <myPID> -n 1 with a terminal that isn't wide enough, the CPU utilization % is omitted from the output. When trying to find a process' cpu utilization via bash scripting, this is ...
0
votes
1answer
1k views
Can you specify a separate trap in a subshell created with ()?
I'm writing a script that starts a subshell to go off and do some work. In a special case, the script needs to tell the subshell to cleanly stop what it's doing and exit early. However, my ...
3
votes
1answer
642 views
A tee >( process ) is truncating its stdout when writing a file
When I use tee to pipe stdout directly to a "specific block of code" (which then writes the modified data to a file), I always get the full complement of exptected output lines in the file.
...
4
votes
1answer
631 views
How do I tell a script to wait for a process to start accepting requests on a port?
I need a command that will wait for a process to start accepting requests on a specific port.
Is there something in linux that does that?
while (checkAlive -host localhost -port 13000 == false)
...
7
votes
3answers
7k views
How can I kill a particular thread of a process?
$ ps -e -T | grep myp | grep -v grep
797 797 ? 00:00:00 myp
797 798 ? 00:00:00 myp
797 799 ? 00:00:00 myp
797 800 ? 00:00:00 myp
This shows the process ...
11
votes
2answers
885 views
Is there a way to intercept interprocess communication in Unix/Linux?
For intercepting/analyzing network traffic, we have a utility called Wireshark.
Do we have a similar utility for intercepting all the interprocess communication between any two processes in ...
10
votes
4answers
13k views
Is there a way to see details of all the threads that a process has in Linux?
For Windows, I think Process Explorer shows you all the threads under a process.
Is there a similar command line utility for Linux that can show me details about all the threads a particular process ...
13
votes
3answers
15k views
How to monitor CPU/memory usage of a single process?
I would like to monitor one process's memory / cpu usage in real time. Similar to top but targeted at only one process, preferably with a history graph of some sort.
