job-control

SIGTSTP(Ctrl-Z) not working for script started by script command

SIGTSTP(Ctrl-Z) not working for script started by script command Note: script refers to the script command, which logs stdin and¬†stdout to files. I was trying to run a script with the¬†script utility to save output for later inspection while preserving text colors on terminal. When I try to suspend the current script with Ctrl+Z (SIGTSTP), …

Total answers: 1

Why does "yes&" crash my Bash session?

Why does "yes&" crash my Bash session? "Yes, and…" is a wonderful rule-of-thumb in improvisational comedy. Not so much in the UNIX world. When I run the admittedly silly yes& command, I cannot interrupt it. The terminal crashes or gets stuck into a loop. I expect the yes process to be suspended immediately, since any …

Total answers: 2

Running grep via GNU parallel

Running grep via GNU parallel How can I make searches with grep on a large number of files run faster? My first attempt uses parallel (which could be improved or other approaches suggested). The first grep simply gives the list of files, which are then passed to parallel, which runs grep again to output matches. …

Total answers: 2

Command dependent on background job finishing

Command dependent on background job finishing I am trying to run a background-job that should send an email after it terminates. The background-job can run several hours and should run independent of the Shell it was started in (because SSH will disconnect). In my current script below the mail command does not wait for the …

Total answers: 1

Possible to pause console operation?

Possible to pause console operation? I have many working jobs running on different consoles. They almost occupied all the CPU usage, which caused me hard to control the system ( very slow response time ) Is there any way to pause these consoles? or any other ways? #update I am actually building Yocto in many …

Total answers: 2

What exactly does it mean to run a process in the "background"?

What exactly does it mean to run a process in the "background"? I want to understand a little bit better, what a background process is. The question came to live as a result of reading this line of code: /usr/sbin/rsyslogd -niNONE & Source The documentations says: -i pid file Specify an alternative pid file instead …

Total answers: 1

kill %1 equivalent in fish

kill %1 equivalent in fish In bash, if I run kill %1, it kills a backgrounded command in the current shell (the most recent one, I believe). Is there an equivalent of this in fish? I haven’t been able to find it online in a bit of web searching. I’m not sure if I did …

Total answers: 2

Programmaticaly open new terminal with Bash and run commands, keeping job-control

Programmaticaly open new terminal with Bash and run commands, keeping job-control In an X session, I can follow these steps: Open a terminal emulator (Xterm). Bash reads .bashrc and becomes interactive. The command prompt is waiting for commands. Enter vim ‘my|file*’ ‘!another file&’. Vim starts, with my|file* and !another file& to be edited. Press CTRL-Z. …

Total answers: 2

How to plan a task to run after another already running task in bash?

How to plan a task to run after another already running task in bash? I’m looking for something like command1 ; command2 i.e. how to run command2 after command1 but I’d like to plan execution of command2 when command1 is already running. It can be solved by just typing the command2 and confirming by Enter …

Total answers: 5

How to stop a bash while loop running in the background?

How to stop a bash while loop running in the background? I started a while loop as follows: while true; do {command}; sleep 180; done & Notice the &. I thought when I killed the terminal, this while loop would stop. But it is still going. It has been hours since I killed the terminal …

Total answers: 3

How to run multiple background jobs in linux?

How to run multiple background jobs in linux? I have a basic understanding of how to get a job in foreground switch to background and vice-versa but I am trying to come up with a way so that I can run multiple jobs in the background.I tried to put multiple jobs in the background but …

Total answers: 3

How to kill all jobs in bash?

How to kill all jobs in bash? So, I have some jobs like this: sleep 30 | sleep 30 & The natural way to think would be: kill `jobs -p` But that kills only the first sleep but not the second. Doing this kills both processes: kill %1 But that only kills at most one …

Total answers: 5

Background, zombie, daemon and without ctty – are these concepts connected?

Background, zombie, daemon and without ctty – are these concepts connected? How these process concepts are related together – background, zombie, daemon and without controlling terminal? I feel that they are somehow close, especially through the concept of controlling terminal, but there is still not much info for me to tell a story, like if …

Total answers: 3

What does "fg" stand for?

What does "fg" stand for? There is no manual entry for ctrl-z or fg. What does “fg” stand for in the context of job control? In other words, typing ctrl-z will suspend the current job drop me back into the shell, and the command “fg” re-activates the suspended job. What does “fg” stand for? Asked …

Total answers: 1

How can I run OpenVPN as root in the background, in a script?

How can I run OpenVPN as root in the background, in a script? I’d like to write a script that calls openvpn first, followed by ssh. When typing the command sudo openvpn ~/my_connection.ovpn in the command prompt I get the following output: … Wed Jan 4 21:04:35 2017 do_ifconfig, tt->ipv6=0, tt->did_ifconfig_ipv6_setup=0 Wed Jan 4 21:04:35 …

Total answers: 3

Clean way to bring back background process to foreground in shell script

Clean way to bring back background process to foreground in shell script As an example: I have working shell script which starts up weblogic (which will continue to run) and then do deployment At the end I bring background process back to foreground, so that shell script does not exit (Exited with code 0) #!/bin/bash …

Total answers: 1

prevent "[1] + done $scriptname" and "[1] 31303" to be shown

prevent "[1] + done $scriptname" and "[1] 31303" to be shown I have set up an alias for my mutt: alias mutt=’$HOME/.mutt/run-notmuch-offlineimap & ; mutt’. Note: Changing my Alias to alias mutt=’$HOME/.mutt/run-notmuch-offlineimap 2> /dev/null & ; mutt’ or to alias mutt=’$HOME/.mutt/run-notmuch-offlineimap 2>&1 >/dev/null & ; mutt’ produces the exact same result. The script run-notmuch-offlineimap looks …

Total answers: 2