pull/109/head
midoks 3 years ago
parent b17dc7b4d2
commit b282fa9c4e
  1. 20
      plugins/rsyncd/index.py
  2. 2
      plugins/rsyncd/init.d/rsyncd.service.tpl

@ -77,15 +77,14 @@ def status():
def appConf(): def appConf():
if mw.isAppleSystem(): return getServerDir() + '/rsyncd.conf'
return getServerDir() + '/rsyncd.conf' # return '/etc/rsyncd.conf'
return '/etc/rsyncd.conf'
def appConfPwd(): def appConfPwd():
if mw.isAppleSystem(): # if mw.isAppleSystem():
return getServerDir() + '/rsyncd.passwd' return getServerDir() + '/rsyncd.passwd'
return '/etc/rsyncd.passwd' # return '/etc/rsyncd.passwd'
def getLog(): def getLog():
@ -99,15 +98,16 @@ def getLog():
def initDreplace(): def initDreplace():
conf_path = appConf()
conf = mw.readFile(conf_path)
compile_sub = re.compile('^#(.*)', re.M) # conf
conf = compile_sub.sub('', conf) conf_path = appConf()
conf_tpl_path = getPluginDir() + '/conf/rsyncd.conf' conf_tpl_path = getPluginDir() + '/conf/rsyncd.conf'
if conf.strip() == '': if conf.strip() == '':
of not os.path.exists(conf_path):
content = mw.readFile(conf_tpl_path) content = mw.readFile(conf_tpl_path)
mw.writeFile(conf_path, content) mw.writeFile(conf_path, content)
# pwd
confpwd_path = appConfPwd() confpwd_path = appConfPwd()
if not os.path.exists(confpwd_path): if not os.path.exists(confpwd_path):
mw.writeFile(confpwd_path, '') mw.writeFile(confpwd_path, '')

@ -3,7 +3,7 @@ Description=fast remote file copy program daemon
ConditionPathExists={$SERVER_PATH}/rsyncd/rsyncd.conf ConditionPathExists={$SERVER_PATH}/rsyncd/rsyncd.conf
[Service] [Service]
ExecStart={$RSYNC_BIN} --daemon --no-detach ExecStart={$RSYNC_BIN} --config={$SERVER_PATH}/rsyncd/rsyncd.conf --daemon --no-detach
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

Loading…
Cancel
Save