Skip to content

Instantly share code, notes, and snippets.

@yosemitebandit
Created May 6, 2015 00:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yosemitebandit/214fe192c928f8a83636 to your computer and use it in GitHub Desktop.
Save yosemitebandit/214fe192c928f8a83636 to your computer and use it in GitHub Desktop.
get the output of the "gprs list" command in OpenBTS for analysis purposes
"""Continuously records the output of "gprs list" from OpenBTSCLI.
Run as follows (then you can logout of the session and it'll keep going):
$ nohup python gprs_lister.py &
"""
import time
import envoy
logpath = '/home/endaga/gprs-list.log'
period = 60
separator = '\n==========\n'
while True:
response = envoy.run('/OpenBTS/OpenBTSCLI -c "gprs list"')
with open(logpath, 'a') as logfile:
logfile.write('%s%s' % (response.std_out, separator))
time.sleep(period)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment