rabin 4 years ago
parent
commit
0549c88f35

+ 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