16
votes
4answers
2k views

What happens if you edit a script during execution?

I have a general question, which might be a result of misunderstanding of how processes are handled in Linux. For my purposes I am going to define a 'script' as a snippet of bash code saved to a text ...
3
votes
2answers
251 views

Why can't pgrep find scripts started via env?

For example: $ cat foo.sh #!/usr/bin/env bash while true; do sleep 1 ; done $ ./foo.sh & $ pgrep foo.sh $ Contrast with: $ cat bar.sh #!/bin/bash while true; do sleep 1 ; done $ ./bar.sh & ...
1
vote
2answers
418 views

Mysterious bash instances using a lot of CPU, how can I debug?

I seem to have multiple bash processes running that are taking up most of my CPU. This is the output of top -c: PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 20116 ...
2
votes
2answers
2k views

Find the process id of a java application in a bash script (to see if the target application is already running)

I know there are a million questions on getting the process ID, but this one seems to be unique. Google has not given me the answer, so I hope stackexhange will help rather than close this question. ...
4
votes
1answer
493 views

A script's background process is still alive after closing the terminal

This is more of a process management/signal handling question than a Bash question. It just uses Bash to explain the issue. I'm running a Bash script in which I run a background process. This is the ...
1
vote
1answer
169 views

How to ensure a process has started reading a file before continuing?

I'm trying to write a command to test that data is written to a file. My first approach was: Start reading in the background. Write some data to the file. Wait for the reader to find a result. ...
1
vote
3answers
77 views

What are the proper tools to setup a remote compilation and running (something like ideone)?

I'm trying to achieve similar functionality in a server for community programming and I've drafted this to wrap up another take on oneide's functions: From a Perl CGI I build a script like this (not ...
6
votes
3answers
297 views

Undo bg; Undo putting a process into the background?

I've started a long running and machine hog process. I've hit CTRL-Z to stop it. I've then put it in the background with bg. Oops, I should have restarted with fg so that I could easily stop and start ...
3
votes
4answers
849 views

How to run java process to be seen not as 'java…' in processes list?

Is it possible to run a Java process in Linux in a way that it could be seen in ps as some sort of alias? It would be easier to restart it when it is down.
0
votes
1answer
3k views

How to know how long a process has been running? [duplicate]

Possible Duplicate: How to check how a long a program has been running? I am interested in doing this purely using bash.
6
votes
2answers
272 views

How is a graphical application started from a bash session connected to that bash session?

When I start a graphical application from a terminal running bash, that application is somehow connected to that bash session. For example, when the applications dumps some text it will appear in the ...