summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/ci24
-rwxr-xr-xbin/co24
-rwxr-xr-xbin/dd_extractbin0 -> 15976 bytes
-rwxr-xr-xbin/dd_listbin0 -> 16000 bytes
-rwxr-xr-xbin/ejectbin0 -> 50048 bytes
-rwxr-xr-xbin/identbin0 -> 113096 bytes
-rwxr-xr-xbin/lsscsibin0 -> 57832 bytes
-rwxr-xr-xbin/mergebin0 -> 113080 bytes
-rwxr-xr-xbin/rcsbin0 -> 179816 bytes
-rwxr-xr-xbin/rcsclean24
-rwxr-xr-xbin/rcsdiff24
-rwxr-xr-xbin/rcsfreeze132
-rwxr-xr-xbin/rcsmerge24
-rwxr-xr-xbin/rlog24
-rwxr-xr-xbin/sunhpc153
-rwxr-xr-xbin/syncDaemon167
16 files changed, 596 insertions, 0 deletions
diff --git a/bin/ci b/bin/ci
new file mode 100755
index 0000000..f349367
--- /dev/null
+++ b/bin/ci
@@ -0,0 +1,24 @@
+#!/bin/sh
+# ci (GNU RCS) 5.9.0
+#
+# Copyright (C) 2013 Thien-Thi Nguyen
+#
+# This file is part of GNU RCS.
+#
+# GNU RCS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GNU RCS is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty
+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+d=`echo "$0" | sed 's|[^/]*$||'`
+exec "$d"rcs ci "$@"
+
+# ci ends here
diff --git a/bin/co b/bin/co
new file mode 100755
index 0000000..2e7d145
--- /dev/null
+++ b/bin/co
@@ -0,0 +1,24 @@
+#!/bin/sh
+# co (GNU RCS) 5.9.0
+#
+# Copyright (C) 2013 Thien-Thi Nguyen
+#
+# This file is part of GNU RCS.
+#
+# GNU RCS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GNU RCS is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty
+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+d=`echo "$0" | sed 's|[^/]*$||'`
+exec "$d"rcs co "$@"
+
+# co ends here
diff --git a/bin/dd_extract b/bin/dd_extract
new file mode 100755
index 0000000..ef5bcb5
--- /dev/null
+++ b/bin/dd_extract
Binary files differ
diff --git a/bin/dd_list b/bin/dd_list
new file mode 100755
index 0000000..83dc32a
--- /dev/null
+++ b/bin/dd_list
Binary files differ
diff --git a/bin/eject b/bin/eject
new file mode 100755
index 0000000..a750440
--- /dev/null
+++ b/bin/eject
Binary files differ
diff --git a/bin/ident b/bin/ident
new file mode 100755
index 0000000..85830ac
--- /dev/null
+++ b/bin/ident
Binary files differ
diff --git a/bin/lsscsi b/bin/lsscsi
new file mode 100755
index 0000000..1a0971d
--- /dev/null
+++ b/bin/lsscsi
Binary files differ
diff --git a/bin/merge b/bin/merge
new file mode 100755
index 0000000..cb97c61
--- /dev/null
+++ b/bin/merge
Binary files differ
diff --git a/bin/rcs b/bin/rcs
new file mode 100755
index 0000000..e0abbd0
--- /dev/null
+++ b/bin/rcs
Binary files differ
diff --git a/bin/rcsclean b/bin/rcsclean
new file mode 100755
index 0000000..548491d
--- /dev/null
+++ b/bin/rcsclean
@@ -0,0 +1,24 @@
+#!/bin/sh
+# rcsclean (GNU RCS) 5.9.0
+#
+# Copyright (C) 2013 Thien-Thi Nguyen
+#
+# This file is part of GNU RCS.
+#
+# GNU RCS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GNU RCS is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty
+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+d=`echo "$0" | sed 's|[^/]*$||'`
+exec "$d"rcs rcsclean "$@"
+
+# rcsclean ends here
diff --git a/bin/rcsdiff b/bin/rcsdiff
new file mode 100755
index 0000000..10e6170
--- /dev/null
+++ b/bin/rcsdiff
@@ -0,0 +1,24 @@
+#!/bin/sh
+# rcsdiff (GNU RCS) 5.9.0
+#
+# Copyright (C) 2013 Thien-Thi Nguyen
+#
+# This file is part of GNU RCS.
+#
+# GNU RCS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GNU RCS is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty
+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+d=`echo "$0" | sed 's|[^/]*$||'`
+exec "$d"rcs rcsdiff "$@"
+
+# rcsdiff ends here
diff --git a/bin/rcsfreeze b/bin/rcsfreeze
new file mode 100755
index 0000000..0a13a17
--- /dev/null
+++ b/bin/rcsfreeze
@@ -0,0 +1,132 @@
+#! /bin/sh
+# rcsfreeze - assign a symbolic revision number to a configuration of RCS files
+#
+# Copyright (C) 2010-2013 Thien-Thi Nguyen
+#
+# This file is part of GNU RCS.
+#
+# GNU RCS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GNU RCS is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty
+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+##
+# Usage: rcsfreeze [symbolic-name]
+#
+# The idea is to run rcsfreeze each time a new version is checked
+# in. A unique symbolic revision number (C_[number], where number
+# is increased each time rcsfreeze is run) is then assigned to the most
+# recent revision of each RCS file of the main trunk.
+#
+# If the command is invoked with an argument, then this
+# argument is used as the symbolic name to freeze a configuration.
+# The unique identifier is still generated
+# and is listed in the log file but it will not appear as
+# part of the symbolic revision name in the actual RCS file.
+#
+# A log message is requested from the user which is saved for future
+# references.
+#
+# The shell script works only on all RCS files at one time.
+# It is important that all changed files are checked in (there are
+# no precautions against any error in this respect).
+# file names:
+# {RCS/}.rcsfreeze.ver version number
+# {RCS/}.rscfreeze.log log messages, most recent first
+##
+version='rcsfreeze (GNU RCS) 5.9.0
+Copyright (C) 2010-2013 Thien-Thi Nguyen
+Copyright (C) 1990-1995 Paul Eggert
+License GPLv3+; GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.
+
+Written by Stephan v. Bechtolsheim.'
+
+usage ()
+{
+ sed '/^##/,/^##/!d;/^##/d;s/^# //g;s/^#$//g' $0
+}
+
+if [ x"$1" = x--help ] ; then usage ; exit 0 ; fi
+if [ x"$1" = x--version ] ; then echo "$version" ; exit 0 ; fi
+
+PATH=/usr/local/bin:/bin:/usr/bin:/usr/ucb:$PATH
+export PATH
+
+DATE=`date` || exit
+# Check whether we have an RCS subdirectory, so we can have the right
+# prefix for our paths.
+if test -d RCS
+then RCSDIR=RCS/ EXT=
+else RCSDIR= EXT=,v
+fi
+
+# Version number stuff, log message file
+VERSIONFILE=${RCSDIR}.rcsfreeze.ver
+LOGFILE=${RCSDIR}.rcsfreeze.log
+# Initialize, rcsfreeze never run before in the current directory
+test -r $VERSIONFILE || { echo 0 >$VERSIONFILE && >>$LOGFILE; } || exit
+
+# Get Version number, increase it, write back to file.
+VERSIONNUMBER=`cat $VERSIONFILE` &&
+VERSIONNUMBER=`expr $VERSIONNUMBER + 1` &&
+echo $VERSIONNUMBER >$VERSIONFILE || exit
+
+# Symbolic Revision Number
+SYMREV=C_$VERSIONNUMBER
+# Allow the user to give a meaningful symbolic name to the revision.
+SYMREVNAME=${1-$SYMREV}
+echo >&2 "rcsfreeze: symbolic revision number computed: \"${SYMREV}\"
+rcsfreeze: symbolic revision number used: \"${SYMREVNAME}\"
+rcsfreeze: the two differ only when rcsfreeze invoked with argument
+rcsfreeze: give log message, summarizing changes (end with EOF or single '.')" \
+ || exit
+
+# Stamp the logfile. Because we order the logfile the most recent
+# first we will have to save everything right now in a temporary file.
+TMPLOG=`mktemp -t` || exit
+trap 'rm -f $TMPLOG; exit 1' 1 2 13 15
+# Now ask for a log message, continously add to the log file
+(
+ echo "Version: $SYMREVNAME($SYMREV), Date: $DATE
+-----------" || exit
+ while read MESS
+ do
+ case $MESS in
+ .) break
+ esac
+ echo " $MESS" || exit
+ done
+ echo "-----------
+" &&
+ cat $LOGFILE
+) >$TMPLOG &&
+
+# combine old and new logfiles
+cp $TMPLOG $LOGFILE &&
+rm -f $TMPLOG &&
+
+# Now the real work begins by assigning a symbolic revision number
+# to each rcs file. Take the most recent version on the default branch.
+
+# If there are any .*,v files, throw them in too.
+# But ignore RCS/.* files that do not end in ,v.
+DOTFILES=
+for DOTFILE in ${RCSDIR}.*,v
+do
+ if test -f "$DOTFILE"
+ then
+ DOTFILES="${RCSDIR}.*,v"
+ break
+ fi
+done
+
+exec rcs -q -n$SYMREVNAME: ${RCSDIR}*$EXT $DOTFILES
diff --git a/bin/rcsmerge b/bin/rcsmerge
new file mode 100755
index 0000000..b62f940
--- /dev/null
+++ b/bin/rcsmerge
@@ -0,0 +1,24 @@
+#!/bin/sh
+# rcsmerge (GNU RCS) 5.9.0
+#
+# Copyright (C) 2013 Thien-Thi Nguyen
+#
+# This file is part of GNU RCS.
+#
+# GNU RCS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GNU RCS is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty
+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+d=`echo "$0" | sed 's|[^/]*$||'`
+exec "$d"rcs rcsmerge "$@"
+
+# rcsmerge ends here
diff --git a/bin/rlog b/bin/rlog
new file mode 100755
index 0000000..99e3e22
--- /dev/null
+++ b/bin/rlog
@@ -0,0 +1,24 @@
+#!/bin/sh
+# rlog (GNU RCS) 5.9.0
+#
+# Copyright (C) 2013 Thien-Thi Nguyen
+#
+# This file is part of GNU RCS.
+#
+# GNU RCS is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# GNU RCS is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty
+# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+d=`echo "$0" | sed 's|[^/]*$||'`
+exec "$d"rcs rlog "$@"
+
+# rlog ends here
diff --git a/bin/sunhpc b/bin/sunhpc
new file mode 100755
index 0000000..82f02f9
--- /dev/null
+++ b/bin/sunhpc
@@ -0,0 +1,153 @@
+#!/opt/sunpy3/bin/python3
+#coding:utf-8
+
+import os
+import sys
+import pwd
+import sunhpc
+import syslog
+import shutil
+import sunhpc.invoke
+
+if sys.getdefaultencoding() != 'utf-8':
+ reload(sys)
+ sys.setdefaultencoding('utf-8')
+
+def ttySize():
+ try:
+ (width, heigh) = shutil.get_terminal_size()
+ except:
+ width = 80
+ return width
+
+os.environ['COLUMNS'] = str(ttySize())
+syslog.openlog('SunhpcCMD', syslog.LOG_PID, syslog.LOG_LOCAL0)
+
+try:
+ import sqlalchemy
+ import sunhpc.db.helper
+
+ database = sunhpc.db.helper.DatabaseHelper()
+ database.connect()
+
+except ImportError:
+ raise
+except sqlalchemy.exc.OperationalError:
+ raise
+
+# 如果参数为空,应当主动赋值帮助,就当成sunhpc help命令.
+if len(sys.argv) == 1:
+ args = [ 'list', 'help']
+else:
+ args = sys.argv[1:]
+#
+# 如果这个sunhpc 没有参数, 则使用 sunhpc list help
+# 否则, 使用第二个参数, 例如 sunhpc list
+# 那么 args[0] = 永远指定第二个参数.
+# 检查命令是否被圈引
+# sunhpc aa bb -- 那么cmd=['aa']
+# sunhpc "aa bb" -- 那么cmd=['aa','bb']
+module = None
+cmd = args[0].split()
+
+# 一般不会执行这里.
+# 只有命令参数带入引号,才会执行此处.
+# 例如: sunhpc "aa bb" 而 sunhpc aa bb 则跳过此处.
+if len(cmd) > 1:
+ s = 'sunhpc.commands.%s' % '.'.join(cmd)
+ # 此时模块路径应该是 sunhpc.commands.aa.bb
+ try:
+ # 如果没有此模块,则触发ModuleNotFoundError异常.
+ __import__(s)
+
+ # 如果模块存在,但是报错,应该是头部没有进行import 相关模块.
+ # 触发 NameError 异常.
+ module = eval(s)
+
+ # 设定变量,供后面for递减模块中args列表从第二个参数取值使用.
+ i = 1
+ except:
+ module = None
+
+# 这里正式开始检查命令参数.
+if not module:
+ # 递减sunhpc 参数.
+ for i in range(len(args), 0, -1):
+ s = 'sunhpc.commands.%s' % '.'.join(args[:i])
+ # sunhpc.commands.aa.bb
+ # sunhpc.commands.aa
+ try:
+ # 倒序检查模块是否存在.
+ __import__(s)
+ module = eval(s)
+ if module:
+ # 如果找到模块,那么其余的参数,就会作为模块参数提供给此模块.
+ break
+ except ImportError:
+ continue
+
+# 如果没有找到提供的任何模块,则命令执行失败.
+if not module:
+ print ('error - invalid sunhpc command "%s"' % args[0])
+ sys.exit(-1)
+
+# 将模块路径重新转化成命令行形式格式.
+# sunhpc.commands.aa.bb
+# sunhpc commands aa bb 去除sunhpc commands.
+# name = aa bb
+name = ' '.join(s.split('.')[2:])
+
+# 此时module已经找到相应的模块了.
+# module = sunhpc.commands.aa.bb
+
+try:
+ # 检查module模块是否有Command类,如果没有则触发 AttributeError 异常.
+ command = getattr(module, 'Command')(database)
+except AttributeError:
+ # 没有Command类,则会执行到此处.到这里我们需要调用帮助信息.
+ #
+ # 此时的bb模块中没有Command类.
+ # 命令:sunhpc aa bb
+ # 已知module路径. sunhpc.commands.aa.bb
+ # 已经name变量, aa bb
+ #
+ # 导入sunhpc帮助模块
+ import sunhpc.commands.list.help
+ help = sunhpc.commands.list.help.Command(database)
+ # 将module路径转换成列表然后使用切片找出模块全路径和子路径.
+ fullmodpath = s.split('.')
+ submodpath = '/'.join(fullmodpath[2:])
+
+ # 执行Command类中run函数.第一个参数是字典,第二个是列表.
+ help.run({'subdir':submodpath}, [])
+ print (help.getText())
+ sys.exit(-1)
+
+# 如果有Command类, 则执行主模块sunhpc.commands.__init__中的runWapper函数
+# 两种用途
+# 1, 收集命令参数并且转换成固定格式.
+# 2, 开始执行命令入口函数.
+# 如果触发自定义命令异常,则输出使用帮助信息.
+if command.MustBeRoot and not (command.isRootUser() or command.isApacheUser()):
+ # 如果需要特权权限, 则需要提权操作.
+ os.system('sudo %s' % ' '.join(sys.argv))
+else:
+ # 收集参数等信息,然后运行模块run函数,错误则触发CommandError异常.
+ # runWrapper是主模块中的Command类中的入口函数.
+ # name : 当前模块路径.
+ # args : 当前有效模块后面全部视为参数.
+ try:
+ command.runWrapper(name, args[i:])
+ text = command.getText()
+ if len(text) > 0:
+ print (text.rstrip())
+ if text[len(text)-1] != '\n':
+ print ()
+ except sunhpc.core.utils.CommandError as e:
+ msg = ' '.join(str(e).split())
+ #print ("\033[91m[errs] %s\033[0m" % msg)
+ print (msg)
+ print (command.usage())
+ exit(1)
+
+syslog.closelog()
diff --git a/bin/syncDaemon b/bin/syncDaemon
new file mode 100755
index 0000000..30aa123
--- /dev/null
+++ b/bin/syncDaemon
@@ -0,0 +1,167 @@
+#!/opt/sunpy3/bin/python3
+#coding:utf-8
+import os, sys, time, queue
+import pickle, base64, shutil, tempfile
+import logging, random, argparse, configparser
+from multiprocessing.managers import BaseManager
+class QueueManager(BaseManager):
+ pass
+s_queue = queue.Queue()
+r_queue = queue.Queue()
+
+class Application(object):
+
+ def __init__(self):
+
+ self.conf = '/etc/sunhpc-plugin.conf'
+ self.addr = None
+ self.port = None
+ self.keys = None
+ self.conn = None
+ self.send = None
+ self.recv = None
+
+ self.modules = {}
+ self.logfile = '/opt/sunhpc/logs/syncdaemon.log'
+
+ def config(self):
+ config = configparser.ConfigParser()
+ if os.path.exists(self.conf):
+ try:
+ config.read(self.conf)
+ self.addr = config['plugins']['address']
+ self.port = int(config['plugins']['port'])
+ self.keys = config['plugins']['keys'].encode('utf-8')
+ except KeyError as e:
+ self.exelog('Read "/etc/sunhpc-plugin.conf error - %s' % repr(e))
+
+ def parseArgs(self):
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--addr', metavar='addr', nargs='?', help='IP address')
+ parser.add_argument('--port', metavar='port', nargs='?', help='IP port')
+ parser.add_argument('--keys', metavar='keys', nargs='?', help='Secret key')
+ parser.add_argument('--conf', metavar='conf', nargs='?', help='Config file')
+
+ args = parser.parse_args()
+ if args.addr:
+ self.addr = args.addr
+ if args.port:
+ self.port = args.port
+ if args.keys:
+ self.keys = args.keys.encode('utf-8')
+ if args.conf:
+ self.conf = args.conf
+
+ def register(self):
+ QueueManager.register('send_queue', callable=lambda: s_queue)
+ QueueManager.register('recv_queue', callable=lambda: r_queue)
+ manager = QueueManager(address=(self.addr, self.port), authkey=self.keys)
+ return manager
+
+ def connect(self):
+ self.conn = self.register()
+ self.conn.start()
+ self.send = self.conn.send_queue()
+ self.recv = self.conn.recv_queue()
+
+ def load_plugins(self):
+ plugin_path = '/opt/sunhpc/var/plugins/syncdata'
+ sys.path.append(plugin_path)
+ tmpdirs = tempfile.mkdtemp()
+ self.modules['temp'] = tmpdirs
+ self.modules['path'] = plugin_path
+ self.modules['plugins'] = []
+
+ for plugin_file in os.listdir(plugin_path):
+ plugin_dict = {}
+ if not plugin_file.endswith('.py'):
+ continue
+
+ if plugin_file in ['plugins.py']:
+ fn = os.path.join(plugin_path, plugin_file)
+ with open(fn, 'rb') as f:
+ self.modules['init'] = base64.b64encode(f.read())
+ continue
+
+ p = plugin_file.split('.py')[0]
+ plugin = __import__(p).plugin()
+ plugin_dict['file'] = plugin_file
+ plugin_dict['modname'] = p
+ # 获取src开头函数名称作为模块字典中 key.
+ # src函数在服务器端执行后放入字典中 value.
+ for fname in plugin.get_srcfuncname(plugin):
+ plugin_n = getattr(plugin, fname)
+ plugin_dict[fname] = plugin_n()
+
+ # 只获取set开头函数并且放入模块字典中.
+ # set函数在客户端中执行.
+ for setname in plugin.get_setfuncname(plugin):
+ plugin_dict[setname] = None
+
+ filename = os.path.join(plugin_path, plugin_file)
+ with open(filename, 'rb') as f:
+ content = base64.b64encode(f.read())
+ plugin_dict['source'] = content
+
+ self.modules['plugins'].append(plugin_dict)
+
+ shutil.rmtree(tmpdirs)
+
+ def running(self):
+
+ print ('addr -- %s' % self.addr)
+ print ('port -- %s' % self.port)
+ self.outputlog('start the syncdaemon...')
+ self.connect()
+ if not self.modules:
+ self.load_plugins()
+
+ data = pickle.dumps(self.modules)
+ running = 1
+ while running:
+ time.sleep(1)
+ try:
+ self.send.put(data)
+ result = self.recv.get(timeout=3)
+ if result == 'exit':
+ running = 0
+
+ self.outputlog(result)
+ except queue.Empty:
+ pass
+
+ self.conn.shutdown()
+ self.outputlog('end the syncdaemon...')
+
+ def outputlog(self, s):
+ log_format = "%(asctime)s %(name)s %(levelname)s %(message)s"
+ dateformat = '%Y-%m-%d %H:%M:%S %a'
+ logging.basicConfig(
+ level = logging.DEBUG,
+ format = log_format,
+ datefmt = dateformat,
+ filename = self.logfile
+ )
+ if s:
+ logging.info(s)
+
+if __name__ == "__main__":
+
+ #
+ # 使用createKeys函数创建一个16位秘钥.
+ # 如果想创建一个新的秘钥,那么删除
+ # /opt/sunhpc/data/.daemon_keys 文件.
+ # 将会重新创建一个新的秘钥.
+ #
+ # syncDaemon --addr 127.0.0.1 --port 5000
+ #
+ app = Application()
+ app.config()
+ app.parseArgs()
+ app.running()
+
+
+
+
+
+