diff --git a/plugins/rsyncd/conf/lsyncd.conf b/plugins/rsyncd/conf/lsyncd.conf new file mode 100644 index 000000000..b2ed2416f --- /dev/null +++ b/plugins/rsyncd/conf/lsyncd.conf @@ -0,0 +1,6 @@ +settings { + logfile = "{$SERVER_PATH}/rsyncd/lsyncd.log", + inotifyMode = "CloseWrite", + maxProcesses = 8, + statusFile = "{$SERVER_PATH}/rsyncd/lsyncd.status" +} \ No newline at end of file diff --git a/plugins/rsyncd/index.html b/plugins/rsyncd/index.html index 01c22f35e..23d878188 100755 --- a/plugins/rsyncd/index.html +++ b/plugins/rsyncd/index.html @@ -3,8 +3,8 @@

服务

自启动

+

发送配置

接收配置

-

日志

说明

@@ -15,7 +15,7 @@ \ No newline at end of file diff --git a/plugins/rsyncd/init.d/lsyncd.service.tpl b/plugins/rsyncd/init.d/lsyncd.service.tpl index 2ee441060..c7daa03d6 100755 --- a/plugins/rsyncd/init.d/lsyncd.service.tpl +++ b/plugins/rsyncd/init.d/lsyncd.service.tpl @@ -1,70 +1,9 @@ -#!/bin/sh -# chkconfig: 2345 55 25 -# description: rsyncd Service +[Unit] +Description=fast remote file copy program daemon +ConditionPathExists={$SERVER_PATH}/rsyncd/rsyncd.conf -### BEGIN INIT INFO -# Provides: rsyncd -# Required-Start: $all -# Required-Stop: $all -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: starts rsyncd -# Description: starts the rsyncd -### END INIT INFO - -ROOT_PATH={$SERVER_PATH} - -p_start(){ - isStart=$(ps -ef | grep rsync | grep 'daemon' | grep -v grep | grep -v python | awk '{print $2}') - if [ "$isStart" == '' ];then - echo -e "Starting rsync... \c" - if [ -f /var/run/rsyncd.pid ]; then - rm -rf /var/run/rsyncd.pid - fi - /usr/bin/rsync --daemon --config=/etc/rsyncd.conf - sleep 0.3 - isStart=$(ps -ef | grep rsync | grep 'daemon' | grep -v grep | grep -v python | awk '{print $2}') - if [ "$isStart" == '' ];then - echo -e "\033[31mError: rsyncd service startup failed.\033[0m" - return; - fi - echo -e "\033[32mdone\033[0m" - else - echo "Starting rsyncd(pid $isStart) already running" - fi -} - -p_stop(){ - echo -e "Stopping rsyncd... \c"; - pids=$(ps -ef | grep rsync | grep 'daemon' | grep -v grep | grep -v python | awk '{print $2}') - arr=($pids) - - for p in ${arr[@]} - do - kill -9 $p - done - - if [ -f /var/run/rsyncd.pid ]; then - rm -rf /var/run/rsyncd.pid - fi - echo -e "\033[32mdone\033[0m" -} - - -case "$1" in - start) - p_start - ;; - stop) - p_stop - ;; - restart|reload) - p_stop - sleep 0.3 - p_start - ;; - *) - echo "Please use start or stop as first argument" - ;; -esac +[Service] +ExecStart={$LSYNC_BIN} --config={$SERVER_PATH}/rsyncd/lsyncd.conf --daemon --no-detach +[Install] +WantedBy=multi-user.target diff --git a/plugins/rsyncd/install.sh b/plugins/rsyncd/install.sh index f3d18b296..5747e8990 100755 --- a/plugins/rsyncd/install.sh +++ b/plugins/rsyncd/install.sh @@ -30,8 +30,9 @@ Install_rsyncd() echo y | pacman -Sy rsync echo y | pacman -Sy lsyncd elif [[ "$OSNAME" == "macos" ]]; then - brew install rsync - brew install lsyncd + # brew install rsync + # brew install lsyncd + echo "ok" else yum install -y rsync yum install -y lsyncd @@ -39,6 +40,7 @@ Install_rsyncd() mkdir -p $serverPath/rsyncd mkdir -p $serverPath/rsyncd/secrets + mkdir -p $serverPath/rsyncd/send echo '2.0' > $serverPath/rsyncd/version.pl echo '安装完成' > $install_tmp diff --git a/plugins/rsyncd/js/rsyncd.js b/plugins/rsyncd/js/rsyncd.js index b2635e42d..04d86cb8d 100755 --- a/plugins/rsyncd/js/rsyncd.js +++ b/plugins/rsyncd/js/rsyncd.js @@ -36,8 +36,57 @@ function rsPost(method,args,callback, title){ },'json'); } +///////////////// ----------------- 发送配置 ---------------- ////////////// + +function rsyncdSend(){ + rsPost('rec_list', '', function(data){ + var rdata = $.parseJSON(data.data); + if (!rdata.status){ + layer.msg(rdata.msg,{icon:rdata.status?1:2,time:2000,shade: [0.3, '#000']}); + return; + } + // console.log(rdata); + var list = rdata.data; + var con = ''; + + con += '
\ + \ + \ + \ +
'; + + con += '
'; + con += ''; + con += ''; + con += ''; + con += ''; + con += ''; + con += ''; + + con += ''; + + //编辑 + for (var i = 0; i < list.length; i++) { + con += ''+ + '' + + '' + + '' + + '\ + '; + } + + con += ''; + con += '
服务名路径备注操作(添加)
' + list[i]['name']+'' + list[i]['path']+'' + list[i]['comment']+'\ + 命令\ + | 删除
'; + + $(".soft-man-con").html(con); + }); +} + +///////////////// ----------------- 接收配置 ---------------- ////////////// function rsyncdConf(){ rsPost('conf', {}, function(rdata){ rpath = rdata['data']; @@ -50,7 +99,7 @@ function rsyncdConf(){ } function rsyncdLog(){ - pluginStandAloneLogs("rsyncd","","run_log") + pluginStandAloneLogs("rsyncd","","run_log"); }