Skip to main content

Questions tagged [jobs]

29 votes
2 answers
6k views

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 ...
Sebastian Carlos's user avatar
0 votes
1 answer
628 views

How can I have "names" for my background processes (not just the command)?

I run a lot of vim windows, and often put them in the bg. The problem is that they all say vim when I list jobs so it's hard to distinguish. [1] - suspended nvim [2] - suspended nvim [3] + ...
pixelearth's user avatar
0 votes
1 answer
5k views

Cron Job vs. Scheduler: Understanding the Differences and Use Cases

What are the key differences between a Cron job and a scheduler, and in what use cases is using one of these tools more appropriate than using the other?
orchard's user avatar
0 votes
1 answer
104 views

Why are commands reading from /dev/stdin get a status "[1]+ Stopped" when sent to background?

I have tried running the following commands: cat base64 /dev/stdin md5sum /dev/stdin tail /dev/stdin In all cases when I do: ^Z $ bg $ jobs I get the status: [1]+ Stopped instead of [1]+ Running. ...
Marinos An's user avatar
4 votes
1 answer
238 views

Why do backgrounded commands in Zsh functions not show correctly in jobs?

In Bash 5.2, the output of jobs after either of the following is identical modulo job numbers: sleep 3 # press C-z s() { sleep 3; } s # press C-z In both, jobs produces something like [1]+ Stopped ...
D. Ben Knoble's user avatar
6 votes
1 answer
1k views

Why jobs lost when after reconnect ssh?

I have a job that runs in the background via ctrl + z and bg, and after reconnecting ssh I cannot find that job in the jobs command but can find it in ps grep. For now, I searched this and I get the ...
Yang Xu's user avatar
  • 103
3 votes
1 answer
2k views

What signal do bg and fg send?

I know that ctrl + z changes a process from foreground to background - as suspended - through SIGTSTP. I am able to re-run that background suspended process through either fg or bg as required. ...
Manuel Jordan's user avatar
20 votes
2 answers
96k views

How do I list all background processes?

Is it possible to list all running background processes with the ps command, or is the only option for getting a list of background processes the jobs command?
hal's user avatar
  • 315
2 votes
2 answers
1k views

Call other process after executing a blocking process in shell

I have a process that is blocking in nature. It is executed first. In order to execute the second process, I moved the first process to the background and executed the second process. Using the wait ...
ravi's user avatar
  • 143
2 votes
2 answers
58 views

Is there a way to quickly change dir to one from where one of the jobs is running?

The output of jobs looks something like this [1] Stopped TERM=xterm-256color vim --servername vim ~/.gitconfig [2]- Stopped TERM=xterm-256color vim --servername vim ~...
Enlico's user avatar
  • 2,342
3 votes
1 answer
11k views

Reliable way to get PID of piped background process

I need to retrieve the PID of a process piped into another process that together are spawned as a background job in bash. Previously I simply relied on pgrep, but as it turns out there can be a delay ...
emike's user avatar
  • 53
0 votes
2 answers
1k views

cron job terminating after sometime while executing the script

I have several cronjobs which runs at different times in a day, but one particular cron job is not running as expected and getting terminated after sometime. 0 0 * * * python3 /scratch/pyscripts/...
Chandra Sekhar K's user avatar
3 votes
0 answers
184 views

Can't grep or word count the output of jobs command in dash

This is what I tested in Arch's dash shell and FreeBSD's default sh shell, the results are the same. $ sleep 100 & $ jobs [1] + Running sleep 100 $ jobs | wc 0 0 ...
Lu Xu's user avatar
  • 131
0 votes
0 answers
389 views

run one command and execute another after first killed by CTRL C in bash

I need to start a service1 in bash commandline. After a while I dont need that service anymore and I do a CTRL-C to stop it. The service started another background service2. To stop that I usually do ...
Paul G.'s user avatar
  • 101
0 votes
0 answers
543 views

start command in linux

I have a custom script which runs on a cPanel server (CentOS 6) which is as below. It starts a service on the specified port which accepts incoming data. It uses start command and runs ok. #!/bin/bash ...
Ravi Kumar CH's user avatar

15 30 50 per page
1
2 3 4 5
10