Questions tagged [background-process]

On POSIX systems a background-process is created in a shell by either adding an ampersand symbol after a command (e.g. ./script.sh &) or by pressing CTRL+Z while the command is being executed. The command will then run independently from the shell but will still write stdout and stderr output to the shell from where it has been started. It can only be stopped with the kill command.

Filter by
Sorted by
Tagged with
61 votes
6 answers
87k views

How can I run mongod in the background on unix (mac osx)?

I would like to run mongod in the background as an always present sort of thing. What would be the best way to do this? Kind of like the way I can run MySQL on startup and it's just always there ...
rmontgomery429's user avatar
33 votes
4 answers
55k views

Writing to stdin of background process

I'm on an Ubuntu 10.04 box, and started a server in the background (myserver &) over ssh. It's been running fine, but I need a way to get at the server's stdin, as the only way to control the ...
tajmorton's user avatar
  • 445
30 votes
1 answer
50k views

How to send running process to background?

Once in a while I will issue a command that takes longer than I had thought it would (archiving a directory or something). How do I escape the process, send it to the background, and return to the ...
doub1ejack's user avatar
24 votes
3 answers
24k views

How do I start a process in suspended state under Linux?

Practically, I need a process which behaves, as if I had pressed Ctrl+Z just after it started. Hopefully, it is possible to do such thing using a shell script. (Also, knowing the resulting PID would ...
java.is.for.desktop's user avatar
14 votes
4 answers
75k views

There is any way to run processes in the background in Windows? nohup equivalent for windows

nohup runs a process in the background. There is any equivalent for Windows?
Jader Dias's user avatar
  • 4,745
13 votes
2 answers
46k views

How to schedule a task to call a URL

I have an MVC app. I have a controller that when called runs a background process to query Active Directory and updates the database. http://myapp/BackgroundTask/Run I want to run this on a ...
Jack's user avatar
  • 517
8 votes
4 answers
7k views

Bash: Put a job in the background and then tail the log

How do you make the escaping work so that the & is actually running the first command in the background? # foo param1 param2 >> run.out &; tail -f run.out
Paul Tarjan's user avatar
7 votes
2 answers
8k views

Start Sinatra app in the background with stdout and stderr redirected (append) to a file

I have a Sinatra app which I run on my local machine using ruby app.rb. While deploying it on a remote machine via ssh, how do I run it in background and redirect stdout and stderr to a log file? On ...
letronje's user avatar
  • 429
7 votes
1 answer
2k views

Job Control/background process (using ampersand) in .ebextensions config commands

Take for example the following .config file in .ebextensions/ container_commands: 000_run_queue_daemon: command: "nohup php artisan queue:work --daemon &" test: "ps -ef | grep artisan ...
Ben Swinburne's user avatar
6 votes
5 answers
31k views

Tools to run a background process command line in windows?

In linux we just need to append a & and that's all. What for windows?
vps's user avatar
  • 1,237
6 votes
1 answer
4k views

nohup vs screen vs ? for manually starting daemon processes

When I need to start a background process on a low-importance server, I tend to use nohup: nohup ./server.sh & Most colleagues seem to prefer screen: screen -D -R mydaemon ./mydaemon.sh ^A ^D ...
Steve Bennett's user avatar
5 votes
6 answers
6k views

Running Subversion post-commit hook as a background process

Because currently our Subversion post-commit hooks take way too long to execute I've been trying to speed things up. I've been thinking about executing the actual hooks as a background process, so ...
Rene Saarsoo's user avatar
5 votes
5 answers
25k views

Running python app in the background on linux

Weird question here, but I'm playing with a python chat server/client combo on my Linux server. Currently, if I do this: $: cd /path/to/chat/server $: sudo python ChatServer_Listen.py This starts ...
Daddy's user avatar
  • 237
5 votes
2 answers
731 views

Shell background processes: what do characters in termination message mean?

I had three background processes, and here's what I've got: [1] Done zcat jan.txt.gz > j [2]- Done zcat feb.txt.gz > f [3]+ Done ...
alamar's user avatar
  • 69
5 votes
3 answers
12k views

How to use nohup to continue to run a command after the user logout?

nohup <command> <arg> & When I SSH into a Linux server, if I want to run a command and make sure that it will continue to run in the background after I logout from SSH, I will use the ...
userpal's user avatar
  • 613
5 votes
2 answers
3k views

Dynamic number of supervisord controlled processes

I am using supervisord's [program:x] to keep my background queue runners up and running. The amount of numprocs is set to a static number, but now I am looking for a solution to dynamically adjust the ...
Ville Mattila's user avatar
3 votes
5 answers
451 views

Is there a simple way to daemon-ify a simple task?

I ssh into a server than start a job (for instance rsync), then I just want to be able to log out from the server and let the job run its course. But if I just do rsync ... & I think it's still ...
Jonas Byström's user avatar
3 votes
2 answers
26k views

cmd.exe: how to start a background process, run some things, stop background process

I want to run a batch script that: starts a background process (a Selenium RC server, if that matters); waits until the background process starts to listening some port (or wait a fixed amount of ...
Seiti's user avatar
  • 145
3 votes
1 answer
3k views

Move a running process in background and keep it running even if you disconnect

You already have a running process and you want to put it to run in background. If you want to be sure that this will still run after you close you ssh connection, what should you do? Note: you are ...
sorin's user avatar
  • 8,216
3 votes
2 answers
1k views

Spawning multiple instances of a daemon in Ubuntu

I have a python script that listens and blocks while it waits for data on a redis list. It runs fine in upstart using the following: description "stage message consumer" author "Nilesh Ashra" start ...
Nilesh Ashra's user avatar
2 votes
2 answers
987 views

Linux: Background process linked to terminal window

I am running linux and I am running a script/program in the background using cmd & This works fine on Solaris, but on my Linux box (2.6.9-55/ Red Hat), the background process stops when the ...
weismat's user avatar
  • 353
2 votes
3 answers
996 views

Am I using too much memory? (Rails on EC2 with Resque)

I am looking at the memory usage of the Rails application (it uses background processes via Resque) and since the common answer to the question, "how many workers is too many" was "test and see", I ...
Stpn's user avatar
  • 145
2 votes
3 answers
8k views

How does antivirus work on a Remote Desktop Services server?

We're rolling out a new Remote Desktop Services server and have decided that it's probably time to install antivirus software on it; while we wait for our vendor/supplier to tell us about the ...
Andrew's user avatar
  • 8,162
2 votes
3 answers
7k views

Monitoring file for changes and immediately take action on change

How can I constantly monitor (small) file for changes? Eg. when file is updated (action from web application), a script is executed (if not already running). Right now, I do it every minute using ...
takeshin's user avatar
  • 1,481
2 votes
3 answers
2k views

Running multiple PHP CLI's in the background gives MySQL errors

We run a meta search engine (price comparison) where each search spawns a number of real-time searches on various websites and presents the merged and sorted search results on our site. We use PHP/...
user avatar
2 votes
3 answers
5k views

Process running in background got killed in linux

I am having a remote server to which i connect using ssh. I started a process(mongodb) on the server using following command- "/usr/bin/mongod --dbpath /mnt/ebs-300/mongodb --logpath /mnt/ebs-300/log/...
4zh4r_s4l4ti's user avatar
2 votes
2 answers
296 views

getting an application to run with the same priority as cpu idle

I have a solaris server that needs to run a timecritical application as fast as possible, although setting it to the RT priority class doesnt seem like a good idea since it may need 100 CPU for ...
camelccc's user avatar
  • 255
2 votes
5 answers
1k views

Amazon Linux: Can't log background task output?

We recently moved to AWS EC2 instances w/ the Amazon Linux distro. On our old servers (RH Enterprise), we've been able to run a command in the background (&) and also redirect the output to a log ...
DOOManiac's user avatar
  • 811
2 votes
1 answer
671 views

How often does a Linux check it's /etc/localtime file

I am trying to troubleshoot a problem. Some very helpful information would lead me to a solution is: Often does Linux check the /etc/localtime file? Additionally if there is a configuration file to ...
DarkSheep's user avatar
  • 1,046
2 votes
4 answers
875 views

Running an application in background

I have a web app on a freebsd server. An app is a single executable file, with a built-in webserver. My default shell is zsh. When I'm running it as "./my_website &" and close a connection, it ...
Dari's user avatar
  • 121
2 votes
2 answers
5k views

keeping a detached ssh process running *after closing the ssh client*

I ssh in to my ubuntu machine usimg mobaxterm. This works very well. Sometimes I want to keep a process running but exit my ssh session (and exit mobaxterm). I have tried the following but ...
lazarus's user avatar
  • 121
2 votes
1 answer
5k views

How can I invoke a foreground process from a background PowerShell Job?

I'm working on a PowerShell script that provides console output and restarts the system several times during the script's operation. As soon as it starts, it registers itself as a Scheduled Job so ...
vmrob's user avatar
  • 123
2 votes
0 answers
375 views

rsync: Maximum nice to keep system responsive

Unfortunately a background rsync reduces the responsiveness of a server. I search a way to have maximum niceness for this background task, to keep the server respond fast. My current wrapper ...
guettli's user avatar
  • 3,823
2 votes
1 answer
608 views

Lot of duplicate sshd daemons getting created in Solaris

I have a Solaris server where I found lot of sshd services running: ps -ef | grep 23492 root 25449 23492 0 15:27:17 ? 0:00 /usr/sbin/sshd2 -oPidFile=/var/run/sshd2_22.pid -R ...
dig_123's user avatar
  • 295
2 votes
0 answers
908 views

Bash and background processes PGID and receiving signals

My actual problem is that a process I run in an rcfile in docker as docker run container bash --rcfile rcfile remains attached to the bash session by sharing the PGID which means that when I Ctrl-C an ...
Arkaitz Jimenez's user avatar
2 votes
1 answer
327 views

Rogue process tracking

I have a debian stable server and I am trying to find a process which wake-up every hour at exactly xh22 (1h22, 2h22, 3h22, etc...) and write something to the disk. However I cannot find the process, ...
SaintGermain's user avatar
2 votes
1 answer
634 views

Send input to background process [closed]

I have a process that i run with this command: java -jar loginserver.jar & I need to be able to send commands to this program. I've tried bg/fg but apparently it doesn't persist thru sessions. ...
Tar's user avatar
  • 265
1 vote
1 answer
589 views

Reliably running background operations

I'm looking for a recommendation on how to reliably run background operations. I have many servers posting operation messages to AWS SQS, and I have another server which will run these CPU intensive ...
Errol Fitzgerald's user avatar
1 vote
2 answers
20k views

Fork a process inside a bash shell script

I've a simple shell script like #!/bin/bash sh -c "sleep 60" & exec sleep 120 In using the pstree command, I found something like `-sleep(11681)---sleep(11682) The first sleep is due to the ...
Ryan's user avatar
  • 6,011
1 vote
1 answer
3k views

What's the difference between cron and services like Supervisord?

Recently I came across supervisor while researching beanstalk stuff. Can someone explain to me why I might use a process management service like that instead of plain old cron jobs?
joshholat's user avatar
  • 193
1 vote
2 answers
1k views

Will the background process exit when you log out in linux?

[root@~]# ./file.sh & I don't know if $! will terminate if I just log out immediately?
vps's user avatar
  • 1,237
1 vote
1 answer
225 views

systemd kills my ngrok session started from python

I have a script i wrote that listens on mqtt. When certain code arrives to the mqtt server then an ngrok session is started like so: subprocess.Popen(['/tmp/ngrok','http' ,'8080'], stdout=subprocess....
codeScriber's user avatar
1 vote
1 answer
2k views

too many ssh-agent process per user on several servers [closed]

Several users seem to have problems with the usage of ssh-agent in their login environment. sri for instance has 1295 of them running on login02. And many other users are having same issue. I am ...
gokam's user avatar
  • 13
1 vote
1 answer
4k views

Kill process and child processes, not parent processes, not group

I need to kill a process and all of its subprocesses programatically. Killing the group is not an option because I do not want to kill the parent processes. Example: pid process 1 ...
firelynx's user avatar
  • 119
1 vote
1 answer
3k views

Run a PHP script as a background process on a WAMP server

I have two PHP scripts that need to be run as continuous background processes on a WAMP server. WAMP is installed on a Windows 7 PC. These scripts are already reside in separate folder in the www ...
arlahiru's user avatar
  • 131
1 vote
1 answer
5k views

Application Pool set to AlwaysRunning does not Auto Start The Hosted Service

I have configured an pool to auto-start and never sleep. I am having problems with the auto-start. My understanding is that a thread pool worker will be started after a recycle when that happens I ...
Ross Bush's user avatar
  • 121
1 vote
1 answer
1k views

Windows Service: specifying a custom stop command

We have a custom application that messes with a LOT of 3rd party resources. When terminating, we need to gracefully "give up the lease" so to speak. The app itself is written in .NET Core (and ...
Paul S.'s user avatar
  • 13
1 vote
1 answer
475 views

how to run 10 process and montring it

i have about 10-15 FFmpeg Process for streaming server like this: ffmpeg -i "http://ip/play/a03i" -vcodec copy -acodec copy -f flv "rtmp://ip:80/APP/Name" am use the Nginx-rtmp module to run it ...
Mohammed's user avatar
1 vote
0 answers
135 views

PHP daemon shows status of "stopped" - can't run php script in the background

I'm trying to launch a PHP script in the background (Linux/Centos 6.8) by appending the & symbol to the command. However, 'jobs' lists the script with status [1]+ Stopped. Issuing a 'bg 1' to run ...
Ryan Griggs's user avatar
  • 1,013
1 vote
1 answer
794 views

Is there an issue with working directory when using service to launch an init script?

I am curious, is there something I need to watch out for when spawning process as background jobs from init scripts using service? Here is the line that works at terminal, in a bash script/an init ...
brandeded's user avatar
  • 1,860