title: Interacting with long-running python script
body: <p>I have a long running Python script which collect tweets from Twitter, and I would like to know how its doing every once in awhile.</p>
  
  <p>Currently, I am using the <code>signal</code> library to catch interrupts, at which point I call my print function.  Something like this:</p>
  
  <pre><code>import signal
  
  def print_info(count):
      print "#Tweets:", count
  
  #Print out the process ID so I can interrupt it for info
  print 'PID:', os.getpid()
  
  #Start listening for interrupts
  signal.signal(signal.SIGUSR1, functools.partial(print_info, tweet_count))
  </code></pre>
  
  <p>And whenever I want my info, I open up a new terminal and issue my interrupt:</p>
  
  <pre><code>$kill -USR1 &lt;pid&gt;
  </code></pre>
  
  <p>Is there a better way to do this?  I am aware I could have my script something at scheduled intervals, but I am more interested in knowing on demand, and potentially issuing other commands as well.</p>