usb-wifi-connect 769 B

1234567891011121314151617181920212223242526
  1. #!/usr/bin/env python3
  2. import sys, time
  3. from daemon import Daemon
  4. import main;
  5. class Service(Daemon):
  6. def run(self):
  7. main.main()
  8. if __name__ == "__main__":
  9. daemon = Service('/tmp/usb-wifi-connect.pid')
  10. if len(sys.argv) == 2:
  11. if 'start' == sys.argv[1]:
  12. daemon.start()
  13. elif 'stop' == sys.argv[1]:
  14. daemon.stop()
  15. elif 'restart' == sys.argv[1]:
  16. daemon.restart()
  17. else:
  18. print ("Unknown command")
  19. sys.exit(2)
  20. sys.exit(0)
  21. else:
  22. print ("usage: %s start|stop|restart" % sys.argv[0])
  23. sys.exit(2)