The background tag has no wiki summary.
29
votes
4answers
12k views
How can I close a terminal without killing the command running in it?
Sometimes I want to start a process and forget about it. If I start it from the command line, like this:
redshift
I can't close the terminal, or it will kill the process. Can I run a command in ...
18
votes
4answers
726 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?
15
votes
3answers
1k views
How to do nothing forever in an elegant way?
I have a program which produces useful information on stdout but also reads from stdin. I want to redirect its standard output to a file without providing anything on standard input. So far, so good: ...
9
votes
2answers
503 views
Is there any way to let it snow on my linux mint destkop?
I want snow fall on my desktop really badly.
Tried Xsnow (with Mate/Marco, Mate/Compiz and KDE/Kwin) but doesn't work.
Snow plugin for Compiz doesn't work anymore either.
Snow feature of KDE was ...
8
votes
2answers
3k views
How to suspend and bring a background process to foreground
I have a process originally running in the foreground. I suspended by Ctrl+Z, and then resume its running in the background by bg <jobid>.
I wonder how to suspend a process running in the ...
8
votes
1answer
224 views
Why does “su -c <command> &” seemingly allow a command to run in the background without hanging up
I was helping a colleague who was having problems with a background process intermittently dying.
I found out that they were starting the background process by logging in to the server and executing:
...
7
votes
6answers
10k views
Execute remote commands, completely detaching from the ssh connection
I have 2 computers, localpc and remoteserver.
I need localpc to execute some commands on remoteserver. One of the things it needs to do is start a backup script that runs for a number of hours. I ...
6
votes
3answers
235 views
How do you send command line apps directly to the background?
I already know that pressing ctrl+z stops the app, then I can send the app to background with the bg command, but that means there is a brief preiod of time that the app is stopped.
How do I send the ...
6
votes
1answer
352 views
Can I make “There are stopped jobs” harder to kill?
Typical scenario:
I temporarily need to access a file that my vhost prevents me from accessing. I fire up vim, edit the settings and background vim to tell apache to reload its configuration.
...
5
votes
2answers
1k views
Running piped bash script in background
I'm attempting to build a monitoring script to watch localhost communication using netcat. I have two scripts that I've built, one to start the monitoring loop and one for the loop itself. They are as ...
5
votes
1answer
100 views
How does sh -e interact with &?
I'm using sh (dash) on Ubuntu (lucid) and the manpage has this to say about -e:
-e errexit If not interactive, exit immediately if any untested command fails.
...
5
votes
1answer
198 views
Whenever I type some wrong command, my terminal tries to run that command in the background
Something strange started happening to my terminal. Whenever I type some wrong command it tries to run that command in the background.
hegeek@colinux: ~# l
[9]+ Stopped l
thegeek@colinux: ~# ...
5
votes
1answer
133 views
Hard drive writes freezing up Gnome
I'm currently running Debian 6.0.5 on my white Macbook 2008 (4,1) and have recently noticed that when I download, move, or decompress a file, Gnome freezes up completely for at least 20 seconds. These ...
4
votes
4answers
917 views
How can I run `watch` as a background job?
When I run:
watch 'cmd >> output.txt' &
the job gets suspended by the system:
3569 Stopped (tty output)
Is there a workaround?
4
votes
3answers
157 views
is there something like a per-user daemon?
I need to run some background processes that live as long as I am logged in with a certain user.
Does there exist something like a per-user daemon? I know only of global daemons that live from ...
3
votes
2answers
365 views
How to reload a background process?
I have a python script which I would like to run in the background. So I do this:
$ nohup python script.py &
If I am frequently making changes to the script, I need to terminate the process ...
3
votes
1answer
65 views
background process pipe-input
if i want to display "aaa" on screen:
(1)$: echo aaa | cat ... works OK
(2)$: echo aaa | ( cat ) ... works OK
(3)$: echo aaa | ( cat & ) ... NOT working
...
3
votes
3answers
248 views
Monitoring progress/liveness of background jobs
I have started a background job. Is there a way to know how it is progressing, and whether it has stopped?
My command line is like:
java weka.classifiers.trees.J48 -t data.arff J48-data.model ...
3
votes
2answers
504 views
Dynamically change desktop background from bash script
Is it possible to change the GNOME desktop background during some period of time by just a random phrase from the list on black screen? Will is seriously load the CPU and consume battery life?
3
votes
3answers
146 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 ...
3
votes
1answer
327 views
ssh “-f” don't give back hand in bash when listening to stdout/stderr
Please look at these:
## Does NOT return to the shell, but Ctrl-C can exit
ssh -S none -fNR 13018:localhost:22 example.com | cat
## Returns to the shell (no "-S none")
ssh -fNR ...
3
votes
0answers
73 views
any way to un-disown / re-attach an interactive process to the tty? [duplicate]
Possible Duplicate:
How can I disown a running process and associate it to a new screen shell?
In bash is there an opposite of disown, that is, to re-attach a process I've accidentally ...
2
votes
2answers
209 views
Bash script needed to run every second
I have a few cleanup commands to run for my datacaching scheme. I was thinking a bash script would be an easy way to check if the full clean up job needed to be run. But the cache is very time ...
2
votes
2answers
236 views
Run program after finish ssh connection
How do I connect to ssh debian and running a program and let it continue to run after you finish my connection through ssh.
2
votes
3answers
659 views
Where do background jobs go?
From gnome-terminal I know the ability to suspend a job with C-z, and then send it to the background. When I close the terminal the process does not end. Where is the job being managed from, or is it ...
2
votes
2answers
588 views
Process not working when executed in background inside shell script
I have an application that runs fine, with and without '&' when run directly from the terminal. However, if I try to execute it from a shell script, it works only if the trailing '&' is ...
2
votes
1answer
336 views
Why do backgrounded processes sometimes stop spontaneously?
Sometimes, some time after I've backgrounded a process with bg in bash, when I press Enter in the same shell to redisplay the prompt (just to check that I'm still in bash when some output from the ...
2
votes
1answer
179 views
Is there a way to temporarily change the terminal colour?
I use the gnome-terminal and most of my editors with a white on black theme as I find its easier on the eyes. One of my labs requires screenshots of the terminal (with the process) to be submitted ...
2
votes
1answer
106 views
How to wait for a subprocess used for I/O redirection?
Consider the following snippet of Bash script:
exec 3> >(sleep 1; echo "$BASHPID: here")
do-something-interesting
exec 3>&-
wait $!
echo "$BASHPID: there"
When executed, it produces:
...
2
votes
1answer
482 views
How to recover a backgrounded job from a previous shell? [duplicate]
Possible Duplicate:
How can I disown a running process and associate it to a new screen shell?
I launched a command that lasts a long time.
I had to disconnect so I moved it in the ...
2
votes
1answer
595 views
Ksh Script to ftp multiple directories simultaneously
I'm new to this site and i have this problem:
I have a directory in unix with multiple directories in it. Each directory have around 5k files in it. So we are talking about 40k to 50k files. I need ...
1
vote
1answer
218 views
Is it possible to customise the prompt to show the if there are any background jobs?
Is it possible to customise the bash prompt to show the if there are any background jobs? I find it easy to forget that there are background jobs.
Say if the prompt was...
$
Is there a way to ...
1
vote
2answers
380 views
Have bash script wait for password
I want to write a little script which sets up a socks proxy via ssh and then starts a browser using that proxy.
#!/bin/bash
ssh -D 1234 user@host #&
chromium-browser ...
1
vote
4answers
104 views
Where to put a background script
I have a script that i want to be constantly running in the background but I don't know where to launch it from
If I put it in .bashrc it will run multiple times (one for each login)
It's an ...
1
vote
3answers
675 views
Bash wait for jobs and limit job count [duplicate]
Possible Duplicate:
Four tasks in parallel… how do I do that?
Suppose a loop invoking a command
grep -v '#' < files.m3u | sed 's/\\\\/\/\//g' | sed 's/\\/\//g' | while read line
...
1
vote
2answers
902 views
How to make a program which run from shell still live after close terminal? [duplicate]
Possible Duplicate:
How do I prevent a script from terminating when the shell exits?
I use gnome-terminal, and I run emacs under the terminal in the background by executing emacs &, but ...
1
vote
2answers
81 views
How to know if a background job is finished?
I invoke a script (do_something) in background via another script (do_manythings) as below.
nohup do_something &
How would I know in the parent script (do_manythings) that the job invoked ...
1
vote
1answer
73 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
1answer
221 views
run a remote process via autossh in background
In Ubuntu I'm trying to run the geany editor on my local X display via the command:
autossh -o StrictHostKeyChecking=false -XCg me@otherDYNDNShost geany &
Trouble is, after the first ...
1
vote
1answer
574 views
daemon function in /init.d does not run the program in the background in fedora13
I use Fedora 13 and am trying to create a service for darkice. I put the script in the /etc/init.d directory and if I use the command service darkice start, the darkice is running in the foreground ...
1
vote
0answers
54 views
how to run ssh -t user@remote 'sudo nohup bash -c “comand”' in background
I want to run a script on a remote host with sudo priviledge,
someone suggests that I should use nohup and ssh -t, like the following command
the script ls;sleep 10;echo finish is crafted here to ...
1
vote
1answer
87 views
Application in terminal still running but not directly accessible [duplicate]
Possible Duplicate:
How to suspend and bring a background process to foreground
I have kind of an odd problem which I haven't encountered before. Here's what I did:
I started an ...
1
vote
0answers
188 views
What happens when you background a function which calls another function?
Question says it all on the tin. Can someone explain to me what goes on here ? I'm trying to find out how to background a process in a script that calls another function and reliably terminate it when ...
0
votes
1answer
73 views
why there is random behaviuor for a background job?
going through advanced bash scripting guide example 3.3 running a loop in background, i found this :
#!/bin/bash
# background-loop.sh
for i in 1 2 3 4 5 6 7 8 9 10 # First loop.
do
echo -n "$i "
done ...
0
votes
2answers
748 views
ssh + nohup does not work
I'm trying to run a program over SSH that keeps running when I disconnect. This Stack Overflow answer gave me the following command:
nohup sleep 30 > foo.out 2> foo.err < /dev/null &
...
0
votes
2answers
244 views
is it possible to run job in foreground after user logout
I have some job to run which need be attached to terminal (or in foreground). The job is run in remote servers, and needs keep running after the users logout. I am aware of vnc server, however, I want ...
0
votes
1answer
261 views
Enter process running in background/bring to foreground [duplicate]
Possible Duplicate:
How can I disown it a running process and associate it to a new screen shell?
I started a java client using nohup to get it to run in the background (needed to log out ...
0
votes
1answer
46 views
RedHat / CentOS 5.5 background process has restricted memory
I run Fisheye that uses Java for Linux. Settings go like this:
generate options
FISHEYE_OPTS=`$JAVACMD -Xms100m -Xmx200m -cp $FISHEYE_HOME/fisheyeboot.jar com.cenqua.fisheye.boot.OptsSetter`
build ...