Help to run it in the background
<p>Here's a simple python daemon I can't manage to run as a background process:</p>

<pre><code>#!/usr/bin/env python 

import socket 

host = '' 
port = 843 
backlog = 5 
size = 1024 
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 
s.bind((host,port)) 
s.listen(backlog) 
while 1: 
   client, address = s.accept() 
   data = client.recv(size) 
   if data == '&lt;policy-file-request/&gt;\0': 
       client.send('&lt;?xml version="1.0"?&gt;&lt;cross-domain-policy&gt;&lt;allow-access-from domain="*" to-ports="*"/&gt;&lt;/cross-domain-policy&gt;') 
   client.close()
</code></pre>

<p>It's a socket policy file server (you may have heard of the restiction Adope put on socket connection - <a href="http://www.adobe.com/devnet/flashplayer/articles/socket_policy_files.html" rel="nofollow">http://www.adobe.com/devnet/flashplayer/articles/socket_policy_files.html</a>); that works well when gets run like an "ordinary" process - "python that_server.py", - but I get problem to run it in the background.</p>

<p>Running like so: "that_server.py &amp;", - does not work.</p>

<p>EDIT: Here's what I got from the shell:</p>

<pre><code>ircd@smoky43g:~$ ls
server.py

ircd@smoky43g:~$ sudo nohup python server.py &amp;
[8] 19817
ircd@smoky43g:~$

[8]+  Stopped                 sudo nohup python server.py
ircd@smoky43g:~$
</code></pre>

<p>I run it then just press the enter button - and it says 'stopped'. What is the problem?</p>

<p>Without the sudo command, the similiar happen:</p>

<pre><code>ircd@smoky43g:~$ nohup python server.py &amp;
[9] 20341
ircd@smoky43g:~$ nohup: ignoring input and appending output to `nohup.out'

[9]   Exit 1                  nohup python server.py
ircd@smoky43g:~$
</code></pre>

<p>EDIT 2: I fount this in the nohup.out file:</p>

<pre><code>python: can't open file 'sudo': [Errno 2] No such file or directory
Traceback (most recent call last):
  File "server.py", line 10, in &lt;module&gt;
    s.bind((host,port))
  File "&lt;string&gt;", line 1, in bind
socket.error: [Errno 13] Permission denied
</code></pre>

<p>UPDATE: I have managed to run it using the root account, but could not as the ircd user (that belongs to the suddoers). And the question now is why not?</p>
