Toggle navigation
Toggle navigation
This project
Loading...
Sign in
UT
/
articles
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Окунев Дмитрий Юрьевич
2014-06-18 14:05:27 +0400
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
beca07c74dce90f62dbe86ee87bfdb5660229b2b
beca07c7
1 parent
47a25ef0
Updated for clsync-0.4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
71 deletions
clsync/inotify-to-many-nodes
clsync/inotify-to-many-nodes
View file @
beca07c
...
...
@@ -54,7 +54,7 @@ pdcp - это утилита позволяющая производить ко
Запуск на master-узле:
clsync -M
direct -S $(which pdcp) -W /opt/global -b -Y syslog -- -a %FILE-LIST%
clsync -M
simple -S $(which pdcp) -W /opt/global -b -Y syslog -- -a %INCLUDE-LIST% %INCLUDE-LIST%
Готово, можно попробовать:
...
...
@@ -90,79 +90,10 @@ uftp - это утилита позволяющая организовывать
# pdsh -a echo uftpd -M 248.225.233.1 -D /opt/production \> /etc/rc.local # или в другое место, в зависимости от вашей системы
# pdsh -a uftpd -M 248.225.233.1 -D /opt/production
Доподготовка master-узла:
cat > /root/uftp-handler.c << EOF
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <clsync/clsync.h>
#include <clsync/configuration.h>
#include <clsync/malloc.h>
#include <clsync/error.h>
struct ctx *ctx_p;
int clsyncapi_init(struct ctx *_ctx_p, struct indexes *_indexes_p) {
ctx_p = _ctx_p;
return 0;
}
int clsyncapi_sync(int n, api_eventinfo_t *ei) {
size_t argv_size;
char **argv;
debug(3, "n == %i", n);
if(n == 0)
return 0;
argv_size = n+5; // "uftp" + "-M" + ip-address + n*path + NULL
argv = xmalloc(argv_size * sizeof(char *));
argv[0] = "/usr/local/bin/uftp";
argv[1] = "-M";
argv[2] = "248.225.233.1";
int i = 3;
int j = 0;
while (i < n) {
if(ei[j].path_len)
argv[i++] = (char*)ei[j].path;
j++;
}
argv[i++] = NULL;
int pid = clsyncapi_fork(ctx_p);
switch(pid) {
case -1:
critical("got error while clsyncapi_fork()");
case 0:
execv(argv[0], argv);
critical("got error while execv()");
}
int status;
if(waitpid(pid, &status, 0) != pid)
critical("got error while waitpid()");
int exitcode = WEXITSTATUS(status);
free(argv);
return exitcode;
}
EOF
gcc -march=native -O2 -funswitch-loops -fpredictive-commoning -fgcse-after-reload -ftree-vectorize -ftree-loop-linear -ftree-loop-im -fweb -frename-registers -fomit-frame-pointer -fexcess-precision=fast -pipe --std=gnu11 -Wall -fPIC -shared -Wl,-O1,--as-needed /root/uftp-handler.c -o /root/uftp-handler.so
Запуск на master-узле:
clsync --mode=
so --sync-handler=/root/uftp-handler.so --watch-dir=/opt/global --background=1 --output=syslog
clsync --mode=
direct --sync-handler=uftp --watch-dir=/opt/global --background=1 --output=syslog -- -M 248.225.233.1 %INCLUDE-LIST%
Готово, можно попробовать:
date >> /opt/global/test.log
\ No newline at end of file
...
...
Please
register
or
login
to post a comment