1

e.g., I want run a python -m HTTPSimpleServer in the background while running a watch in the background

python -m HTTPSimpleServer; watch -n (my awesome test command)

how can I run both in parallel spawning from one command.

4 Answers4

3
python -m HTTPSimpleServer &  # Your Python process will now be in the background
serverpid="$!"                # Capture its PID so that you can kill it later.
watch -n /path/to/AwesomeTestCommand Arg1 Arg2
# Some time later...
kill "$serverpid"             # Make your Python process go away
cas
  • 78,579
DopeGhoti
  • 76,081
1

Try that:

python -m HTTPSimpleServer & watch -n
0

Looks like replacing the ; with & ought to do the job. Add another & at the end to put both programs in the background.

0

This may sound like a reply to an old post, but you can simply run the application in nohup

nohup python -m HTTPSimpleServer & watch -n
IndikaM
  • 101