rabin 4 years ago
parent
commit
0549c88f35
18 changed files with 33 additions and 0 deletions
  1. 0 0
      test/control.py
  2. 0 0
      test/core.py
  3. 0 0
      test/cron.py
  4. 0 0
      test/daemon.py
  5. 0 0
      test/loop.py
  6. 0 0
      test/main.py
  7. 0 0
      test/modbus/client.py
  8. 0 0
      test/modbus/server.py
  9. 0 0
      test/mqtt.py
  10. 0 0
      test/mqtt/pub.py
  11. 0 0
      test/mqtt/sub.py
  12. 33 0
      test/test.py
  13. 0 0
      test/test/pic.py
  14. 0 0
      test/test/pub.py
  15. 0 0
      test/test/sub.py
  16. 0 0
      test/test/switch.py
  17. 0 0
      test/test/tcp.py
  18. 0 0
      test/timing.py

+ 0 - 0
cron/control.py → test/control.py


+ 0 - 0
cron/core.py → test/core.py


+ 0 - 0
cron/cron.py → test/cron.py


+ 0 - 0
daemon.py → test/daemon.py


+ 0 - 0
cron/loop.py → test/loop.py


+ 0 - 0
cron/main.py → test/main.py


+ 0 - 0
cron/modbus/client.py → test/modbus/client.py


+ 0 - 0
cron/modbus/server.py → test/modbus/server.py


+ 0 - 0
mqtt.py → test/mqtt.py


+ 0 - 0
cron/mqtt/pub.py → test/mqtt/pub.py


+ 0 - 0
cron/mqtt/sub.py → test/mqtt/sub.py


+ 33 - 0
test/test.py

@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+
+import os
+import sys
+import time
+from demeter.core import *
+from daemon import Daemon
+
+class MyTestDaemon(Daemon):
+	def run(self):
+		sys.stdout.write('Daemon started with pid {}\n'.format(os.getpid()))
+		while True:
+			sys.stdout.write('Daemon Alive! {}\n'.format(time.ctime()))
+			sys.stdout.flush()
+
+			time.sleep(5)
+
+if __name__ == '__main__':
+	daemon = MyTestDaemon(key='deamon')
+
+	if len(sys.argv) != 2:
+		print('Usage: {} [start|stop]'.format(sys.argv[0]), file=sys.stderr)
+		raise SystemExit(1)
+
+	if 'start' == sys.argv[1]:
+		daemon.start()
+	elif 'stop' == sys.argv[1]:
+		daemon.stop()
+	elif 'restart' == sys.argv[1]:
+		daemon.restart()
+	else:
+		print('Unknown command {!r}'.format(sys.argv[1]), file=sys.stderr)
+		raise SystemExit(1)

+ 0 - 0
test/pic.py → test/test/pic.py


+ 0 - 0
test/pub.py → test/test/pub.py


+ 0 - 0
test/sub.py → test/test/sub.py


+ 0 - 0
cron/switch.py → test/test/switch.py


+ 0 - 0
test/tcp.py → test/test/tcp.py


+ 0 - 0
cron/timing.py → test/timing.py