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.
91
questions
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 ...
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 ...
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 ...
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 ...
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?
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 ...
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
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 ...
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 ...
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?
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
...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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/...
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/...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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, ...
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. ...
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 ...
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 ...
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?
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?
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....
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...