Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have one tool that performs a long-running task. This tool accepts a configuration file. Right now I need to run simultaneously about 15 instances with different configs (using screen for this).

All instances should be restarted at the same time (or almost the same time).

But I think this task can be automated somehow to start/stop all possible configurations.

share|improve this question

Of course it can, that's what shellscripts are for. Lets assume your configs are all in /etc/myapp. Then something like this will do the trick:

killall myapp
while pgrep myapp &>/dev/null; do
  sleep 0.1
for config in /etc/myapp/*; do
    screen -S mapp.$config /usr/local/bin/myapp --config $config

As this is only tangentially related to server administration, I think it's better to ask any followup questions on the unix&linux site.

share|improve this answer
And this does stop his processes how? :-) – Hauke Laging May 9 '13 at 13:28
The killall will do that ;) (added after you comment, thanks) – Dennis Kaarsemaker May 9 '13 at 13:29
any thoughts on killall versus pkill? – glenn jackman May 9 '13 at 13:54
what about place all application under same screen session inside different windows ? – user173090 May 13 '13 at 11:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.