Tagged Questions

The tag has no wiki summary.

learn more… | top users | synonyms

2
votes
0answers
27 views

Configure job to expire

I'm learning Linux at the moment and were doing some exercises scheduling jobs with cron and crontab, but I'm wondering if it's possible to limit the amount of times that the scheduled job is ran. ...
3
votes
4answers
342 views

How to return a background task to be in the foreground?

Well, the title does not say much, but I would like to know how to stop a running process after appending it with &. For example, I would like to install software foo. Now, assume, foo has many ...
4
votes
3answers
94 views

How do I gracefully suspend and resume `cmd1 && cmd2 && cmd3` chain?

From the previous question it seems I failed to understand how && and ^Z interact properly: $ command1 && command2 && command3 Running command1 ... Running command2 ...^Z [1]+ ...
4
votes
2answers
67 views

How do I cancel/replace one element of running `cmd1 && cmd2 && cmd3 && …` chain?

$ command1 && command2 && command3 Running command1 ... Running command2 ...^Z [1]+ Stopped $ fg && command4 && wrong_command5 && command6 Running command3 ...
4
votes
0answers
37 views

Show error messages and information that a program was killed on another terminal [duplicate]

If I open a program, say evince, from the GNOME GUI, it is not attached to a terminal. If I send it a signal, it acts accordingly but nothing shows up in my terminal. If I were to open it in a ...
1
vote
2answers
50 views

Is it necessary to disown a process for it to continue running after disconnecting?

Would someone be kind enough to explain if & why disown is necessary if you wish to keep a job running even after you disconnect. I ask because every site I have visited says to use disown and bg ...
2
votes
2answers
412 views

Killing subprocesses after the script has finished or is killed

Say I have a script like the following #!/usr/bin/env zsh ./subscript.sh & # do stuff ... # do more stuff I would like the process running subscript.sh (and any processes initiated by it) to be ...
3
votes
3answers
81 views

Intelligently switch between multiple BASH processes

Say you're in a directory and you want to check something in another directory, so you type bash to spawn a new shell so you can cd and check that thing and then type exit to get out and go back to ...
2
votes
3answers
114 views

When does one get the error message “jobs : not found”?

When does the jobs command issue the message jobs : not found? Also, why does the command man jobs refuse to show any entry for the command jobs? P.S. : I am able to successfully execute the jobs ...
1
vote
3answers
6k views

How to get the Job ID? [duplicate]

As we know, the shell enables the user to run background processes using & at the command line's end. Each background process is identified by a job ID and, of course, by it's PID. When I'm ...
9
votes
3answers
429 views

If you ^Z from a process, it gets “stopped”. How do you switch back in?

I accidentally "stopped" my telnet process. Now I can neither "switch back" into it, nor can I kill it (it won't respond to kill 92929, where 92929 is the processid.) So, my question is, if you have ...
4
votes
4answers
4k views

Ctrl-C with two simultaneous commands in bash

I want to run two commands simultaneously in bash on a Linux machine. Therefore in my ./execute.sh bash script I put: command 1 & command 2 echo "done" However when I want to stop the bash ...
14
votes
4answers
29k views

How to stop a background process?

I have started a wget on remote machine in background using &. Suddenly it stops downloading. I want to stop its process, then start it again. How can I stop it? I haven't close its shell window. ...
7
votes
2answers
834 views

In Bash scripting, what's the meaning of “ $! ”?

If I'm assigning a variable with temp=$! what would it be its value?
3
votes
3answers
247 views

Quick access to work directory of background job

Minimal effort to reproduce what I am looking for, is as follows /$ sleep 1h & [1] 6564 /$ cd ~$ jobs [1]+ Running sleep 1h & (wd: /) When I use jobs to manage my ...
5
votes
4answers
260 views

Best practices for job/process tracking and multi-tasking

I run 10+ different commands from 10+ different directories, and I need a better process to track everything. I do a lot of debugging, and often times I need to work on multiple issues in parallel. I ...
1
vote
1answer
24 views

Some processes not remaining in jobs list

After a recent workspace reorganization, I am left with a question about the way certain processes interact with the output of jobs. I am running all of my program in the background on one 'Main' ...
1
vote
2answers
130 views

How do I get a field in bash's job list using awk?

I wanted to write a function to retrieve a field from the list of background jobs in bash. For example to get a specific argument. Let's say I send vim to the background, so "jobs" displays this ...
4
votes
3answers
2k views

What happens to suspended jobs in unix?

We can issue CTRL+Z to suspend any jobs in Unix and then later on bring them back to life using fg or bg. I want to understand what happens to those jobs that are suspended like this ? Are they ...
2
votes
1answer
425 views

Please explain the output from the jobs command

When I ran jobs command I see the following output : [1] - Suspended ./startWebLogic.sh [2] + Suspended (signal) top What does -/+ indicate in the second column ? ...
1
vote
3answers
2k views

How can I kill a job that was initiated in another shell (terminal window or tab)?

If I begin a process and background it in a terminal window (say ping google.com &), I can kill it using kill %1 (assuming it is job 1). However if I open another terminal window (or tab) the ...
0
votes
2answers
5k views

Get PID of a function executed in the background

#!/bin/bash function abc() # wait for some event to happen, can be terminated by other process { sleep 3333 } echo "PID: $$" abc & echo "PID: $$" I need to retrieve the pid of this function, ...
9
votes
4answers
4k views

Remove all `at` jobs

I know that to remove a scheduled at job I have to use atrm "numjob1 numjob2", but is there an easy way to do that for all the jobs?
2
votes
1answer
232 views

What's the best strategy to catch mystery process?

I have running processes on my server that get killed every night at midnight. It's at work, I'm not around when it happens and I don't have remote access. The kill occurs very predicably at 23:59 ...
2
votes
1answer
446 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 ...
3
votes
0answers
77 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 ...
0
votes
0answers
138 views

Job IDs and their meaning/reference

Using Red Hat, I sent few jobs to a cluster and got "job IDs" in return. Using qstat I can see only one is running, one was canceled and the rest are still in the queue. I wrote something like this: ...
2
votes
2answers
493 views

changing default shell to /bin/bash of at job scheduler like in CRON

I recently switched from 2>&1 >> to &>> Is there a way to have at use /bin/bash as the shell? By default it uses /bin/sh and the man page gives no indication how anything else ...
23
votes
2answers
28k views

How to get the pid of the last executed command in shell script?

I want to have a shell script like this: my-app & echo $my-app-pid But I do not know how the get the pid of the just executed command. I know I can just use the jobs -p my-app command to grep ...
1
vote
2answers
900 views

Basic job control: stop a job, add a job onto the stack, and `fg`

Job control is probably my favorite thing about Linux. I find myself, often, starting a computationally demanding process that basically renders a computer unusable for up to days at a time, and being ...
2
votes
1answer
593 views

How can I manage jobs after I disconnect from my tty/ssh session?

If I ssh to a box and start a task that will take some time to complete I usually press control+z to pause the process, and then immediately type bg 1 to put run it in the background. I can then type ...
14
votes
4answers
4k views

Why do some commands 'hang' the terminal until they've finished?

Sometimes you run a program from the terminal, say, lxpanel†. The terminal won't drop you back to the prompt, it'll hang. You can press Ctrl+C to get back to the prompt, but that will kill ...
2
votes
1answer
331 views

Get pid of long running command executed via at

I would like to spawn a persistent netcat server. My command of choice is the following: echo "bash -c \"while [ 1 ]; do nc -l -p 1111 >> check; done\"" | at now I am wondering how I can get ...
3
votes
3answers
2k 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 ...
1
vote
2answers
876 views

How can I queue processes?

I have a surveillance camera and a program records videos when motion is detected. Basically, this program saves the video in a very heavy format. My solution was to call a script that converts the ...
0
votes
1answer
970 views

Fun, tricky and hard questions for Unix/Linux Admin interview [closed]

I am now preparing process of recrutation for group of Unix/Linux Administrators and I was wondering if maybe you have idea for fun or tricky or hard questions to ask the candidates in order to test ...
2
votes
1answer
239 views

Switch back to path when resume job from background

Say I open ~/vim.txt, push that to background, then cd to another path. When I bring that job to foreground, is there an option to switch back to old path? I noticed it says pwd, so I assume it is ...