1

I have been working on a project for a few weeks now and I encountered something (probably stupidly simple) I can't figure out!

import os
os.system("service hostapd start && hostapd /etc/hostapd/hostapd.conf")
os.system("service someservicethatIuse start")

When I start hostapd the script pauses because it enables an access point. I tried running it with xfce4-terminal --tab -e "hostapd /etc/hostapd/hostapd.conf" --tab -e "service someservicethatIuser start" but it doesn't seem to work :-/

(Language: Python 2.6)

tripleee
  • 175,061
  • 34
  • 275
  • 318

2 Answers2

1

I don't know about hostapd, but usually it's enough to run service foo start to start a service and it does not block.

Anyways, you could run shell processes in prallel using sh & operator:

import os
os.system("service hostapd start && hostapd /etc/hostapd/hostapd.conf &")
os.system("service someservicethatIuse start")
Arman Ordookhani
  • 6,031
  • 28
  • 41
0

Use the -B option when you start hostapd, it should run it in the background

$~/hostapd -B /etc/hostapd/hostapd.conf

ivarni
  • 17,658
  • 17
  • 76
  • 92
Adam
  • 3
  • 1
  • 2