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.

user2167582
  • 185
  • 1
  • 5

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
  • 1
  • 7
  • 119
  • 185
DopeGhoti
  • 73,792
  • 8
  • 97
  • 133
1

Try that:

python -m HTTPSimpleServer & watch -n
Luciano Andress Martini
  • 6,490
  • 4
  • 26
  • 56
0

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

stolenmoment
  • 622
  • 3
  • 6
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
  • 1