mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-12 19:33:03 +00:00
Added -m and -M command line switches
SVN revision: 1120
This commit is contained in:
parent
87920d109f
commit
55647de163
@ -1,7 +1,7 @@
|
|||||||
<HTML>
|
<HTML>
|
||||||
<HEAD>
|
<HEAD>
|
||||||
<TITLE>ELOG Administrator's Guide</TITLE>
|
<TITLE>ELOG Administrator's Guide</TITLE>
|
||||||
<LINK REV="made" HREF="mailto:fredp@mygale.org">
|
<LINK REV="made" HREF="mailto:fredp@mygale.org">
|
||||||
<META NAME="generator" CONTENT="NoteTab Light 4.86c">
|
<META NAME="generator" CONTENT="NoteTab Light 4.86c">
|
||||||
<META NAME="author" CONTENT="Fred Pacquier">
|
<META NAME="author" CONTENT="Fred Pacquier">
|
||||||
<META NAME="description" CONTENT="Home of the Electronic Logbook (ELOG) package">
|
<META NAME="description" CONTENT="Home of the Electronic Logbook (ELOG) package">
|
||||||
@ -9,7 +9,7 @@
|
|||||||
<LINK REL="stylesheet" TYPE="text/css" HREF="elog.css">
|
<LINK REL="stylesheet" TYPE="text/css" HREF="elog.css">
|
||||||
</HEAD>
|
</HEAD>
|
||||||
|
|
||||||
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000">
|
<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#0000ff" VLINK="#800080" ALINK="#ff0000">
|
||||||
|
|
||||||
<div class=title> ELOG Administrator's Guide </div>
|
<div class=title> ELOG Administrator's Guide </div>
|
||||||
<p>
|
<p>
|
||||||
@ -46,14 +46,14 @@ workstations. It should also compile and run on other UNIX flavours.
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
Since version 2.0, ELOG contains a RPM file which eases the installation. Get the
|
Since version 2.0, ELOG contains a RPM file which eases the installation. Get the
|
||||||
file <code><b>elog-x.x.x-x.i386.rpm</code></b> from the <a href="http://midas.psi.ch/elog/download/RPMS/">download</a>
|
file <code><b>elog-x.x.x-x.i386.rpm</code></B> from the <a href="http://midas.psi.ch/elog/download/RPMS/">download</a>
|
||||||
section and execute as root <code><b>"rpm -i elog-x.x.x-x.i386.rpm"</b></code>. This will
|
section and execute as root <code><b>"rpm -i elog-x.x.x-x.i386.rpm"</b></code>. This will
|
||||||
install the <code><b>elogd</code></b> daemon in <code><b>/usr/local/sbin</code></b>
|
install the <code><b>elogd</code></B> daemon in <code><b>/usr/local/sbin</code></B>
|
||||||
and the <code><b>elog</code></b> and <code><b>elconv</code></b> programs in
|
and the <code><b>elog</code></B> and <code><b>elconv</code></B> programs in
|
||||||
<code><b>/usr/local/bin</code></b>. The sample configuration file <code><b>elogd.cfg</code></b>
|
<code><b>/usr/local/bin</code></B>. The sample configuration file <code><b>elogd.cfg</code></B>
|
||||||
together with the sample logbook will be installed under <code><b>/usr/local/elog</code></b>
|
together with the sample logbook will be installed under <code><b>/usr/local/elog</code></B>
|
||||||
and the documentation goes to <code><b>/usr/share/doc</code></b>. The elogd startup script
|
and the documentation goes to <code><b>/usr/share/doc</code></B>. The elogd startup script
|
||||||
will be installed at <code><b>/etc/rc.d/init.d/elogd</code></b>. To start the daemon, enter
|
will be installed at <code><b>/etc/rc.d/init.d/elogd</code></B>. To start the daemon, enter
|
||||||
|
|
||||||
<ul><code>/etc/rc.d/init.d/elogd start</code></ul>
|
<ul><code>/etc/rc.d/init.d/elogd start</code></ul>
|
||||||
|
|
||||||
@ -78,9 +78,9 @@ which the daemon runs.
|
|||||||
<h3><hr><i>Installation from the tarball</i>:</h3>
|
<h3><hr><i>Installation from the tarball</i>:</h3>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a href="http://midas.psi.ch/elog/download/">Download</a> the latest <code><b>elog-x.x.x.tar.gz</code></b> package.
|
<a href="http://midas.psi.ch/elog/download/">Download</a> the latest <code><b>elog-x.x.x.tar.gz</code></B> package.
|
||||||
<p>
|
<p>
|
||||||
Expand the compressed TAR file with <code><b>tar -xzvf elog-x.x.x.tar.gz</code></b>.
|
Expand the compressed TAR file with <code><b>tar -xzvf elog-x.x.x.tar.gz</code></B>.
|
||||||
This creates a subdirectory <code><b>elog-x.x.x</b></code> where x.x.x is the
|
This creates a subdirectory <code><b>elog-x.x.x</b></code> where x.x.x is the
|
||||||
version number. In that directory execute <code><b>make</b></code>, which
|
version number. In that directory execute <code><b>make</b></code>, which
|
||||||
creates the executables <code><b>elogd</b></code>, <code><b>elog</b></code> and
|
creates the executables <code><b>elogd</b></code>, <code><b>elog</b></code> and
|
||||||
@ -105,7 +105,7 @@ and tries to fall-back to a non-root account. This is necessary to avoid securit
|
|||||||
It looks in the configuration file for the statements <b><code>Usr</code></b> and
|
It looks in the configuration file for the statements <b><code>Usr</code></b> and
|
||||||
<b><code>Grp.</code></b>. If found, <b><code>elogd</code></b> uses that user and goupe
|
<b><code>Grp.</code></b>. If found, <b><code>elogd</code></b> uses that user and goupe
|
||||||
name to run under. The names must of course be present on the system (usually
|
name to run under. The names must of course be present on the system (usually
|
||||||
<b><code>/etc/passwd</b></code> and <b><code>/etc/group</b></code>). If the statements
|
<b><code>/etc/passwd</b></CODE> and <b><code>/etc/group</b></CODE>). If the statements
|
||||||
<b><code>Usr</code></b> and <b><code>Grp.</code></b> are not present, <b><code>elogd</code></b>
|
<b><code>Usr</code></b> and <b><code>Grp.</code></b> are not present, <b><code>elogd</code></b>
|
||||||
tries user and group <b><code>elog</code></b>, then the default user and group (normally
|
tries user and group <b><code>elog</code></b>, then the default user and group (normally
|
||||||
<b><code>nogroup</code></b> and <b><code>nobody</code></b>). Care has to be taken
|
<b><code>nogroup</code></b> and <b><code>nobody</code></b>). Care has to be taken
|
||||||
@ -162,10 +162,10 @@ Redirect permanent /elog http://your.host.domain/elog/
|
|||||||
ProxyPass /elog/ http://your.host.domain:8080/
|
ProxyPass /elog/ http://your.host.domain:8080/
|
||||||
</pre></ul>
|
</pre></ul>
|
||||||
<p>
|
<p>
|
||||||
Make sure that the Apache modules mod_proxy.c and mod_alias.c are activated. Justin Dieters <enderak@yahoo.com>
|
Make sure that the Apache modules mod_proxy.c and mod_alias.c are activated. Justin Dieters <enderak@yahoo.com>
|
||||||
reports that mod_proxy_http.c is also required. The <i>Redirect</i>
|
reports that mod_proxy_http.c is also required. The <i>Redirect</i>
|
||||||
statement is necessary to automatically append a "/" to a request like <code><b>
|
statement is necessary to automatically append a "/" to a request like <code><b>
|
||||||
http://your.host.domain/elog</code></b>. Apache then works as a proxy and forwards all requests
|
http://your.host.domain/elog</code></B>. Apache then works as a proxy and forwards all requests
|
||||||
staring with <code><b>/elog</b></code> to the elogd daemon.<p>
|
staring with <code><b>/elog</b></code> to the elogd daemon.<p>
|
||||||
|
|
||||||
<b>Note: Do not put <code>"ProxyRequests On"</code> into your configuration file. This option is not necessary
|
<b>Note: Do not put <code>"ProxyRequests On"</code> into your configuration file. This option is not necessary
|
||||||
@ -188,7 +188,7 @@ the proxy host (anybody knows how to fix that???).<p>
|
|||||||
|
|
||||||
<h3><hr><i>Notes for the Solaris platform</i>:</h3>
|
<h3><hr><i>Notes for the Solaris platform</i>:</h3>
|
||||||
|
|
||||||
<p><a href="mailto:huber@secaron.de">Martin Huber</a> reports that
|
<p><a href="mailto:huber@secaron.de">Martin Huber</a> reports that
|
||||||
under Solaris 7 the following command line is needed to compile elog:
|
under Solaris 7 the following command line is needed to compile elog:
|
||||||
<P>
|
<P>
|
||||||
<ul><code>gcc -L/usr/lib/ -ldl -lresolv -lm -ldl -lnsl -lsocket elogd.c -o elogd</code></ul>
|
<ul><code>gcc -L/usr/lib/ -ldl -lresolv -lm -ldl -lnsl -lsocket elogd.c -o elogd</code></ul>
|
||||||
@ -200,8 +200,8 @@ the "<B>-k</B>" flag to the <code><b>elogd</b></code> command line to turn keep-
|
|||||||
|
|
||||||
<h3><hr><i>Note for Mac OS X</i>:</h3>
|
<h3><hr><i>Note for Mac OS X</i>:</h3>
|
||||||
|
|
||||||
<p><a href="mailto:sak@essc.psu.edu">Sridhar Anandakrishnan</a> and
|
<p><a href="mailto:sak@essc.psu.edu">Sridhar Anandakrishnan</a> and
|
||||||
<a href="mailto:roktas@emu.edu.tr">Recai Oktas</a> report that under Mac OS X there is a problem with
|
<a href="mailto:roktas@emu.edu.tr">Recai Oktas</a> report that under Mac OS X there is a problem with
|
||||||
the default stack size. The command <i><b>limit stacksize unlimited</b></i> (for tcsh) or
|
the default stack size. The command <i><b>limit stacksize unlimited</b></i> (for tcsh) or
|
||||||
<i><b>ulimit -s unlimited</b></i> (for bash) increases the stacksize and fixes this problem.
|
<i><b>ulimit -s unlimited</b></i> (for bash) increases the stacksize and fixes this problem.
|
||||||
Read the according <a href="http://midas.psi.ch/elogs/Forum/379">thread</a> in the forum.
|
Read the according <a href="http://midas.psi.ch/elogs/Forum/379">thread</a> in the forum.
|
||||||
@ -226,37 +226,42 @@ are still possible, they are not recommended any more.<p>
|
|||||||
Under Windows, the ports below 1024 can be used
|
Under Windows, the ports below 1024 can be used
|
||||||
without restriction. So if no web server is running on the same PC the <b>ELOG</b> daemon can
|
without restriction. So if no web server is running on the same PC the <b>ELOG</b> daemon can
|
||||||
be started under the standard Web port 80. This is achieved by changing the <code><b>port=8080</b></code>
|
be started under the standard Web port 80. This is achieved by changing the <code><b>port=8080</b></code>
|
||||||
option in <code>elogd.cfg</code> to <code><b>port=80</code></b> and restarting elogd.<p>
|
option in <code>elogd.cfg</code> to <code><b>port=80</code></B> and restarting elogd.<p>
|
||||||
|
|
||||||
<hr><a name="config">
|
<hr><a name="config">
|
||||||
<div class=section> Server Configuration </div>
|
<div class=section> Server Configuration </div>
|
||||||
<p>
|
<p>
|
||||||
<a name="config">The <b>ELOG</b> daemon <b><code>elogd</code></b> can be executed with the following options :
|
<a name="config">The <b>ELOG</b> daemon <b><code>elogd</code></b> can be executed with the following options :
|
||||||
<ul><code><pre>elogd [-p port] [-h hostname/IP] [-D] [-c file] [-v] [-k]</code></pre></ul>
|
<ul><code><pre>elogd [-p port] [-h hostname/IP] [-C] [-m] [-M] [-D] [-c file] [-s dir] [-d dir] [-v] [-k] [-f file] [-x]</code></PRE></ul>
|
||||||
<p>with :
|
<p>with :
|
||||||
<ul>
|
<ul>
|
||||||
<li><code>-p <port></code> : TCP port number to use for the http server (if other than 80)
|
<li><code>-p <port></code> TCP port number to use for the http server (if other than 80)
|
||||||
<li><code>-h <hostname or IP address></code> : in the case of a "multihomed" server, host name or IP address of the interface ELOG should run on
|
<li><code>-h <hostname or IP address></code> in the case of a "multihomed" server, host name or IP
|
||||||
<li><code>-D</code> : become a daemon (Unix only)
|
address of the interface ELOG should run on
|
||||||
<li><code>-c <file></code> : specify the configuration file (full path mandatory if -D is used)
|
<LI><code>-C <url></code> clone remote elogd configuration
|
||||||
|
<LI><code>-m</code> synchronize logbook(s) with remote server
|
||||||
|
<LI><code>-M</code> synchronize with removing deleted entries
|
||||||
|
<li><code>-l <logbook></code> optionally specify logbook for -m and -M commands</li>
|
||||||
|
<li><code>-D</code> become a daemon (Unix only)
|
||||||
|
<li><code>-c <file></code> specify the configuration file (full path mandatory if -D is used)
|
||||||
<li><code>-s <dir></code> specify resource directory (themes, icons, ...)
|
<li><code>-s <dir></code> specify resource directory (themes, icons, ...)
|
||||||
<li><code>-d <dir></code> specify logbook root directory
|
<li><code>-d <dir></code> specify logbook root directory
|
||||||
|
|
||||||
<li><code>-v </code> : verbose output for debugging
|
<li><code>-v </code> verbose output for debugging
|
||||||
<li><code>-k </code> : do not use TCP keep-alive
|
<li><code>-k </code> do not use TCP keep-alive
|
||||||
<li><code>-f <file></code> : specify PID file where elogd process ID is written when server is started
|
<li><code>-f <file></code> specify PID file where elogd process ID is written when server is started
|
||||||
<li><code>-x </code> : enables execution of shell commands
|
<li><code>-x </code>enables execution of shell commands</li>
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
<p>
|
<p>
|
||||||
It may also be used to generate passwords :
|
It may also be used to generate passwords :
|
||||||
<ul><code><pre>elogd [-r pwd] [-w pwd] [-a pwd] [-l logbook]</code></pre></ul>
|
<ul><code><pre>elogd [-r pwd] [-w pwd] [-a pwd] [-l logbook]</code></PRE></ul>
|
||||||
<p>with :
|
<p>with :
|
||||||
<ul>
|
<ul>
|
||||||
<li><code>-r <pwd></code> : create/overwrite read password in config file
|
<li><code>-r <pwd></code> create/overwrite read password in config file
|
||||||
<li><code>-w <pwd></code> : create/overwrite write password in config file
|
<li><code>-w <pwd></code> create/overwrite write password in config file
|
||||||
<li><code>-a <pwd></code> : create/overwrite administrative password in config file
|
<li><code>-a <pwd></code> create/overwrite administrative password in config file
|
||||||
<li><code>-l <logbook></code> : specify logbook for -r and -w commands
|
<li><code>-l <logbook></code> specify logbook for -r and -w commands</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p> The appearance, functionality and behaviour of the various logbooks on an <b>ELOG</b> server are
|
<p> The appearance, functionality and behaviour of the various logbooks on an <b>ELOG</b> server are
|
||||||
@ -269,15 +274,15 @@ having to restart the server. Instead of restarting the server, under Unix one c
|
|||||||
like <b><code>"killall -HUP elogd"</code></b> to tell the server to re-read its configuration.<p>
|
like <b><code>"killall -HUP elogd"</code></b> to tell the server to re-read its configuration.<p>
|
||||||
|
|
||||||
The many options of this unique but very important file are documented on the separate <b><a href=
|
The many options of this unique but very important file are documented on the separate <b><a href=
|
||||||
"config.html">elogd.cfg syntax page</a></b>.<p>
|
"config.html" config.html??>elogd.cfg syntax page</a></b>.<p>
|
||||||
|
|
||||||
To better control appearance and layout of the logbooks, <b><code>elogd.cfg</code></b> may
|
To better control appearance and layout of the logbooks, <b><code>elogd.cfg</code></b> may
|
||||||
optionally specify the use of additional files containing HTML code, and/or custom "<I>themes</I>"
|
optionally specify the use of additional files containing HTML code, and/or custom "<I>themes</I>"
|
||||||
configurations. These need to be edited directly from the file system right now. <p>
|
configurations. These need to be edited directly from the file system right now. <p>
|
||||||
|
|
||||||
The meaning of the directory flags <b><code>-s</b></code> and <b><code>-d</b></code> is explained
|
The meaning of the directory flags <b><code>-s</b></CODE> and <b><code>-d</b></CODE> is explained
|
||||||
in the section covering the configuration options <b><code>Resource dir</b></code> and <b><code>
|
in the section covering the configuration options <b><code>Resource dir</b></CODE> and <b><code>
|
||||||
Logbook dir</b></code> in the <b><a href="config.html">elogd.cfg description</a></b>.<p>
|
Logbook dir</b></CODE> in the <b><a href="config.html">elogd.cfg description</a></b>.<p>
|
||||||
|
|
||||||
<hr><a name="secure">
|
<hr><a name="secure">
|
||||||
<div class=section> Secure Connections HOWTO </div>
|
<div class=section> Secure Connections HOWTO </div>
|
||||||
@ -294,11 +299,11 @@ To use <code><b>elogd</b></code> togethwer with
|
|||||||
<OL>
|
<OL>
|
||||||
<LI>Start <code><b>elogd</b></code>. If another Web server is running
|
<LI>Start <code><b>elogd</b></code>. If another Web server is running
|
||||||
on port 80, use a different port.
|
on port 80, use a different port.
|
||||||
<P>
|
<P></P>
|
||||||
<LI>Configure stunnel. This requires the creation of a certificate. See
|
<LI>Configure stunnel. This requires the creation of a certificate. See
|
||||||
the <a href="http://www.stunnel.org/faq/certs.html">manual</a> for
|
the <a href="http://www.stunnel.org/faq/certs.html">manual</a> for
|
||||||
details.
|
details.
|
||||||
<P>
|
<P></P>
|
||||||
<LI>Start the <b><code>stunnel</code></b> program if not already done
|
<LI>Start the <b><code>stunnel</code></b> program if not already done
|
||||||
and start it with:
|
and start it with:
|
||||||
<P>
|
<P>
|
||||||
@ -306,14 +311,14 @@ details.
|
|||||||
Substitute the port 80 if you started <code><b>elogd</b></code> on another port. This
|
Substitute the port 80 if you started <code><b>elogd</b></code> on another port. This
|
||||||
causes <b><code>stunnel</code></b> to receive requests on the https port 443 and
|
causes <b><code>stunnel</code></b> to receive requests on the https port 443 and
|
||||||
forward them to the <code><b>elogd</b></code> port.
|
forward them to the <code><b>elogd</b></code> port.
|
||||||
<P>
|
<P></P>
|
||||||
<LI>Put the URL under which <code><b>elogd</b></code> runs into elogd.cfg:<p>
|
<LI>Put the URL under which <code><b>elogd</b></code> runs into elogd.cfg:<p>
|
||||||
<pre>URL = https://your.host.name/</pre>
|
<pre>URL = https://your.host.name/</pre>
|
||||||
|
|
||||||
Note the <b><code>https</code></b> at the beginning of the URL, which is
|
Note the <b><code>https</code></b> at the beginning of the URL, which is
|
||||||
mandatory. Once you use the <b><code>https</code></b> URL, elog won't work correctly when
|
mandatory. Once you use the <b><code>https</code></b> URL, elog won't work correctly when
|
||||||
accessed not through stunnel via <b><code>http://..</code></b>, since any
|
accessed not through stunnel via <b><code>http://..</code></b>, since any
|
||||||
redirection would always bring you back to https://...).<p>
|
redirection would always bring you back to https://...).<p></p>
|
||||||
|
|
||||||
<LI>Connect to your logbook with a browser which supports SSL via:
|
<LI>Connect to your logbook with a browser which supports SSL via:
|
||||||
<P>
|
<P>
|
||||||
@ -322,7 +327,7 @@ details.
|
|||||||
<P>
|
<P>
|
||||||
<pre>stunnel -f -d 443 -r your.host.name:80</pre>
|
<pre>stunnel -f -d 443 -r your.host.name:80</pre>
|
||||||
|
|
||||||
This reveals any potential error.<p>
|
This reveals any potential error.<p></p></LI>
|
||||||
</OL>
|
</OL>
|
||||||
<p>
|
<p>
|
||||||
|
|
||||||
@ -363,7 +368,7 @@ reads logbook entries from its database and formats them into HTML. Since
|
|||||||
only forms and tables are used, no Java or Javascript is necessary, which makes the logbook display very fast. The system does not use any images on purpose to reduce the amount of data to be transferred. Since the <b>ELOG</b> daemon contains its own <i>http</i> server, no additional server like Apache is required.
|
only forms and tables are used, no Java or Javascript is necessary, which makes the logbook display very fast. The system does not use any images on purpose to reduce the amount of data to be transferred. Since the <b>ELOG</b> daemon contains its own <i>http</i> server, no additional server like Apache is required.
|
||||||
<p>
|
<p>
|
||||||
The "<I>database</I>" in which <b>ELOG</b> saves its entries is in plain ASCII format.
|
The "<I>database</I>" in which <b>ELOG</b> saves its entries is in plain ASCII format.
|
||||||
One file is created for each day in the form <b><code>YYMMDDa.log</b></code>
|
One file is created for each day in the form <b><code>YYMMDDa.log</b></CODE>
|
||||||
(where YY is the year, MM the month and DD the day). For ELOG versions 1.x.x,
|
(where YY is the year, MM the month and DD the day). For ELOG versions 1.x.x,
|
||||||
the format was <b><code>YYMMDD.log</code></b>. Messages are separated internally
|
the format was <b><code>YYMMDD.log</code></b>. Messages are separated internally
|
||||||
by the string <b><code>$@MID@$</code></b>. If this string is entered in a message
|
by the string <b><code>$@MID@$</code></b>. If this string is entered in a message
|
||||||
@ -381,10 +386,10 @@ files from March 2001, just select them with <b><code>0103??a.log</code>
|
|||||||
|
|
||||||
<HR>
|
<HR>
|
||||||
<div class=footer>
|
<div class=footer>
|
||||||
Content by <a class=nav href="mailto:Stefan.Ritt@psi.ch">Stefan Ritt</a>,
|
Content by <a class=nav href="mailto:Stefan.Ritt@psi.ch">Stefan Ritt</a>,
|
||||||
Web pages by <a class=nav href="mailto:fredp@mygale.org">Fred Pacquier</a>
|
Web pages by <a class=nav href="mailto:fredp@mygale.org">Fred Pacquier</a>
|
||||||
- last modified on 16/01/2002
|
- last modified on 16/01/2002
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
</BODY>
|
||||||
</html>
|
</HTML>
|
||||||
|
|||||||
316
src/elogd.c
316
src/elogd.c
@ -6,6 +6,9 @@
|
|||||||
Contents: Web server program for Electronic Logbook ELOG
|
Contents: Web server program for Electronic Logbook ELOG
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.504 2004/10/29 19:32:56 midas
|
||||||
|
Added -m and -M command line switches
|
||||||
|
|
||||||
Revision 1.503 2004/10/27 07:00:44 midas
|
Revision 1.503 2004/10/27 07:00:44 midas
|
||||||
Version 2.5.4-6
|
Version 2.5.4-6
|
||||||
|
|
||||||
@ -12315,10 +12318,10 @@ void synchronize_logbook(LOGBOOK * lbs, int mode, BOOL sync_all)
|
|||||||
mprint(lbs, mode, error_str);
|
mprint(lbs, mode, error_str);
|
||||||
else
|
else
|
||||||
mprint(lbs, mode, "Local config submitted");
|
mprint(lbs, mode, "Local config submitted");
|
||||||
|
md5_cache[0].message_id = -1;
|
||||||
} else
|
} else
|
||||||
mprint(lbs, mode, "Local config should be submitted");
|
mprint(lbs, mode, "Local config should be submitted");
|
||||||
|
|
||||||
md5_cache[0].message_id = -1;
|
|
||||||
|
|
||||||
} else
|
} else
|
||||||
/* if config has been changed remotely, but not on this server, receive it */
|
/* if config has been changed remotely, but not on this server, receive it */
|
||||||
@ -12336,11 +12339,11 @@ void synchronize_logbook(LOGBOOK * lbs, int mode, BOOL sync_all)
|
|||||||
mprint(lbs, mode, error_str);
|
mprint(lbs, mode, error_str);
|
||||||
else
|
else
|
||||||
mprint(lbs, mode, "Remote config received");
|
mprint(lbs, mode, "Remote config received");
|
||||||
|
|
||||||
|
md5_cache[0].message_id = -1;
|
||||||
} else
|
} else
|
||||||
mprint(lbs, mode, loc("Remote config should be received"));
|
mprint(lbs, mode, loc("Remote config should be received"));
|
||||||
|
|
||||||
md5_cache[0].message_id = -1;
|
|
||||||
|
|
||||||
} else
|
} else
|
||||||
/* if config has been changed remotely and on this server, show conflict */
|
/* if config has been changed remotely and on this server, show conflict */
|
||||||
if (!equal_md5(md5_cache[0].md5_digest, md5_remote[0].md5_digest)
|
if (!equal_md5(md5_cache[0].md5_digest, md5_remote[0].md5_digest)
|
||||||
@ -12403,35 +12406,30 @@ void synchronize_logbook(LOGBOOK * lbs, int mode, BOOL sync_all)
|
|||||||
&& equal_md5(md5_cache[i_cache].md5_digest, md5_remote[i_remote].md5_digest)) {
|
&& equal_md5(md5_cache[i_cache].md5_digest, md5_remote[i_remote].md5_digest)) {
|
||||||
|
|
||||||
all_identical = FALSE;
|
all_identical = FALSE;
|
||||||
if (mode == SYNC_CLONE) {
|
|
||||||
|
|
||||||
eprintf("Warning: Entry #%d has been changed locally, will not be retrieved\n", message_id);
|
if (_logging_level > 1)
|
||||||
|
write_logfile(lbs, "MIRROR send entry #%d", message_id);
|
||||||
|
|
||||||
} else {
|
/* submit local message */
|
||||||
|
if (!getcfg(lbs->name, "Mirror simulate", str, sizeof(str))
|
||||||
|
|| atoi(str) == 0) {
|
||||||
|
submit_message(lbs, list[index], message_id, error_str);
|
||||||
|
|
||||||
if (_logging_level > 1)
|
/* not that submit_message() may have changed attr_list !!! */
|
||||||
write_logfile(lbs, "MIRROR send entry #%d", message_id);
|
|
||||||
|
|
||||||
/* submit local message */
|
if (error_str[0])
|
||||||
if (!getcfg(lbs->name, "Mirror simulate", str, sizeof(str))
|
sprintf(str, "%s: %s", loc("Error sending local entry"), error_str);
|
||||||
|| atoi(str) == 0) {
|
else
|
||||||
submit_message(lbs, list[index], message_id, error_str);
|
sprintf(str, "ID%d:\t%s", message_id, loc("Local entry submitted"));
|
||||||
|
mprint(lbs, mode, str);
|
||||||
/* not that submit_message() may have changed attr_list !!! */
|
|
||||||
|
|
||||||
if (error_str[0])
|
|
||||||
sprintf(str, "%s: %s", loc("Error sending local entry"), error_str);
|
|
||||||
else
|
|
||||||
sprintf(str, "ID%d:\t%s", message_id, loc("Local entry submitted"));
|
|
||||||
mprint(lbs, mode, str);
|
|
||||||
} else {
|
|
||||||
sprintf(str, "ID%d:\t%s", message_id, loc("Local entry should be submitted"));
|
|
||||||
mprint(lbs, mode, str);
|
|
||||||
}
|
|
||||||
|
|
||||||
md5_cache[i_cache].message_id = -1;
|
md5_cache[i_cache].message_id = -1;
|
||||||
|
} else {
|
||||||
|
sprintf(str, "ID%d:\t%s", message_id, loc("Local entry should be submitted"));
|
||||||
|
mprint(lbs, mode, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} else
|
} else
|
||||||
/* if message has been changed remotely, but not on this server, receive it */
|
/* if message has been changed remotely, but not on this server, receive it */
|
||||||
if (!equal_md5(md5_cache[i_cache].md5_digest, md5_remote[i_remote].md5_digest)
|
if (!equal_md5(md5_cache[i_cache].md5_digest, md5_remote[i_remote].md5_digest)
|
||||||
@ -12440,7 +12438,7 @@ void synchronize_logbook(LOGBOOK * lbs, int mode, BOOL sync_all)
|
|||||||
all_identical = FALSE;
|
all_identical = FALSE;
|
||||||
|
|
||||||
if (mode == SYNC_CLONE) {
|
if (mode == SYNC_CLONE) {
|
||||||
eprintf("ID%s:\t", message_id);
|
eprintf("ID%d:\t", message_id);
|
||||||
} else if (mode == SYNC_HTML) {
|
} else if (mode == SYNC_HTML) {
|
||||||
if (getcfg_topgroup())
|
if (getcfg_topgroup())
|
||||||
rsprintf("<a href=\"../%s/%d\">ID%d:</a>\t", lbs->name_enc, message_id, message_id);
|
rsprintf("<a href=\"../%s/%d\">ID%d:</a>\t", lbs->name_enc, message_id, message_id);
|
||||||
@ -12470,13 +12468,14 @@ void synchronize_logbook(LOGBOOK * lbs, int mode, BOOL sync_all)
|
|||||||
sprintf(str, "ID%d:\t%s", message_id, loc("Remote entry received"));
|
sprintf(str, "ID%d:\t%s", message_id, loc("Remote entry received"));
|
||||||
mprint(lbs, mode, str);
|
mprint(lbs, mode, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
md5_cache[i_cache].message_id = -1;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
sprintf(str, "ID%d:\t%s", message_id, loc("Remote entry should be received"));
|
sprintf(str, "ID%d:\t%s", message_id, loc("Remote entry should be received"));
|
||||||
mprint(lbs, mode, str);
|
mprint(lbs, mode, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
md5_cache[i_cache].message_id = -1;
|
|
||||||
|
|
||||||
} else
|
} else
|
||||||
/* if message has been changed remotely and on this server, show conflict */
|
/* if message has been changed remotely and on this server, show conflict */
|
||||||
if (!equal_md5(md5_cache[i_cache].md5_digest, md5_remote[i_remote].md5_digest)
|
if (!equal_md5(md5_cache[i_cache].md5_digest, md5_remote[i_remote].md5_digest)
|
||||||
@ -12526,33 +12525,27 @@ void synchronize_logbook(LOGBOOK * lbs, int mode, BOOL sync_all)
|
|||||||
|
|
||||||
all_identical = FALSE;
|
all_identical = FALSE;
|
||||||
|
|
||||||
if (mode == SYNC_CLONE) {
|
if (_logging_level > 1)
|
||||||
|
write_logfile(lbs, "MIRROR send entry #%d", message_id);
|
||||||
|
|
||||||
eprintf("Warning: Entry #%d has been changed locally, will not be retrieved\n", message_id);
|
/* submit local message */
|
||||||
|
if (!getcfg(lbs->name, "Mirror simulate", str, sizeof(str))
|
||||||
|
|| atoi(str) == 0) {
|
||||||
|
submit_message(lbs, list[index], message_id, error_str);
|
||||||
|
|
||||||
} else {
|
/* not that submit_message() may have changed attr_list !!! */
|
||||||
|
|
||||||
if (_logging_level > 1)
|
if (error_str[0])
|
||||||
write_logfile(lbs, "MIRROR send entry #%d", message_id);
|
sprintf(str, "%s: %s", loc("Error sending local message"), error_str);
|
||||||
|
else
|
||||||
/* submit local message */
|
sprintf(str, "ID%d:\t%s", message_id, loc("Local entry submitted"));
|
||||||
if (!getcfg(lbs->name, "Mirror simulate", str, sizeof(str))
|
mprint(lbs, mode, str);
|
||||||
|| atoi(str) == 0) {
|
|
||||||
submit_message(lbs, list[index], message_id, error_str);
|
|
||||||
|
|
||||||
/* not that submit_message() may have changed attr_list !!! */
|
|
||||||
|
|
||||||
if (error_str[0])
|
|
||||||
sprintf(str, "%s: %s", loc("Error sending local message"), error_str);
|
|
||||||
else
|
|
||||||
sprintf(str, "ID%d:\t%s", message_id, loc("Local entry submitted"));
|
|
||||||
mprint(lbs, mode, str);
|
|
||||||
} else {
|
|
||||||
sprintf(str, "ID%d:\t%s", message_id, loc("Local entry should be submitted"));
|
|
||||||
mprint(lbs, mode, str);
|
|
||||||
}
|
|
||||||
|
|
||||||
md5_cache[i_cache].message_id = -1;
|
md5_cache[i_cache].message_id = -1;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
sprintf(str, "ID%d:\t%s", message_id, loc("Local entry should be submitted"));
|
||||||
|
mprint(lbs, mode, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -12573,15 +12566,17 @@ void synchronize_logbook(LOGBOOK * lbs, int mode, BOOL sync_all)
|
|||||||
rsprintf("ID%d:\t%s\n", message_id, str);
|
rsprintf("ID%d:\t%s\n", message_id, str);
|
||||||
n_delete++;
|
n_delete++;
|
||||||
|
|
||||||
} else {
|
} if (!isparam("confirm") && mode == SYNC_CLONE) {
|
||||||
|
|
||||||
|
sprintf(str, "ID%d:\t%s", message_id, loc("Entry should be deleted locally"));
|
||||||
|
mprint(lbs, mode, str);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
all_identical = FALSE;
|
all_identical = FALSE;
|
||||||
|
|
||||||
if (_logging_level > 1)
|
if (mode == SYNC_CLONE) {
|
||||||
write_logfile(lbs, "MIRROR delete local entry #%d", message_id);
|
|
||||||
|
|
||||||
if (!getcfg(lbs->name, "Mirror simulate", str, sizeof(str))
|
|
||||||
|| atoi(str) == 0) {
|
|
||||||
el_delete_message(lbs, message_id, TRUE, NULL, TRUE, TRUE);
|
el_delete_message(lbs, message_id, TRUE, NULL, TRUE, TRUE);
|
||||||
|
|
||||||
sprintf(str, "ID%d:\t%s", message_id, loc("Entry deleted locally"));
|
sprintf(str, "ID%d:\t%s", message_id, loc("Entry deleted locally"));
|
||||||
@ -12589,9 +12584,25 @@ void synchronize_logbook(LOGBOOK * lbs, int mode, BOOL sync_all)
|
|||||||
|
|
||||||
/* message got deleted from local message list, so redo current index */
|
/* message got deleted from local message list, so redo current index */
|
||||||
i_msg--;
|
i_msg--;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
sprintf(str, "ID%d:\t%s", message_id, loc("Entry should be deleted locally"));
|
|
||||||
mprint(lbs, mode, str);
|
if (_logging_level > 1)
|
||||||
|
write_logfile(lbs, "MIRROR delete local entry #%d", message_id);
|
||||||
|
|
||||||
|
if (!getcfg(lbs->name, "Mirror simulate", str, sizeof(str))
|
||||||
|
|| atoi(str) == 0) {
|
||||||
|
el_delete_message(lbs, message_id, TRUE, NULL, TRUE, TRUE);
|
||||||
|
|
||||||
|
sprintf(str, "ID%d:\t%s", message_id, loc("Entry deleted locally"));
|
||||||
|
mprint(lbs, mode, str);
|
||||||
|
|
||||||
|
/* message got deleted from local message list, so redo current index */
|
||||||
|
i_msg--;
|
||||||
|
} else {
|
||||||
|
sprintf(str, "ID%d:\t%s", message_id, loc("Entry should be deleted locally"));
|
||||||
|
mprint(lbs, mode, str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* mark message non-conflicting */
|
/* mark message non-conflicting */
|
||||||
@ -12606,33 +12617,26 @@ void synchronize_logbook(LOGBOOK * lbs, int mode, BOOL sync_all)
|
|||||||
|
|
||||||
all_identical = FALSE;
|
all_identical = FALSE;
|
||||||
|
|
||||||
if (mode == SYNC_CLONE) {
|
if (_logging_level > 1)
|
||||||
|
write_logfile(lbs, "MIRROR send entry #%d", message_id);
|
||||||
|
|
||||||
eprintf("Warning: Entry #%d exists only locally, should be sent to server\n", message_id);
|
remote_id = 0;
|
||||||
|
if (!getcfg(lbs->name, "Mirror simulate", str, sizeof(str))
|
||||||
|
|| atoi(str) == 0) {
|
||||||
|
remote_id = submit_message(lbs, list[index], message_id, error_str);
|
||||||
|
|
||||||
|
if (error_str[0])
|
||||||
|
sprintf(str, "%s: %s", loc("Error sending local entry"), error_str);
|
||||||
|
else if (remote_id != message_id)
|
||||||
|
sprintf(str,
|
||||||
|
"Error: Submitting entry #%d resulted in remote entry #%d\n",
|
||||||
|
message_id, remote_id);
|
||||||
|
else
|
||||||
|
sprintf(str, "ID%d:\t%s", message_id, loc("Local entry submitted"));
|
||||||
|
mprint(lbs, mode, str);
|
||||||
} else {
|
} else {
|
||||||
|
sprintf(str, "ID%d:\t%s", message_id, loc("Local entry should be submitted"));
|
||||||
if (_logging_level > 1)
|
mprint(lbs, mode, str);
|
||||||
write_logfile(lbs, "MIRROR send entry #%d", message_id);
|
|
||||||
|
|
||||||
remote_id = 0;
|
|
||||||
if (!getcfg(lbs->name, "Mirror simulate", str, sizeof(str))
|
|
||||||
|| atoi(str) == 0) {
|
|
||||||
remote_id = submit_message(lbs, list[index], message_id, error_str);
|
|
||||||
|
|
||||||
if (error_str[0])
|
|
||||||
sprintf(str, "%s: %s", loc("Error sending local entry"), error_str);
|
|
||||||
else if (remote_id != message_id)
|
|
||||||
sprintf(str,
|
|
||||||
"Error: Submitting entry #%d resulted in remote entry #%d\n",
|
|
||||||
message_id, remote_id);
|
|
||||||
else
|
|
||||||
sprintf(str, "ID%d:\t%s", message_id, loc("Local entry submitted"));
|
|
||||||
mprint(lbs, mode, str);
|
|
||||||
} else {
|
|
||||||
sprintf(str, "ID%d:\t%s", message_id, loc("Local entry should be submitted"));
|
|
||||||
mprint(lbs, mode, str);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12644,41 +12648,34 @@ void synchronize_logbook(LOGBOOK * lbs, int mode, BOOL sync_all)
|
|||||||
|
|
||||||
all_identical = FALSE;
|
all_identical = FALSE;
|
||||||
|
|
||||||
if (mode == SYNC_CLONE) {
|
/* find max id both locally and remotely */
|
||||||
|
max_id = 1;
|
||||||
|
for (i = 0; i < *lbs->n_el_index; i++)
|
||||||
|
if (lbs->el_index[i].message_id > max_id)
|
||||||
|
max_id = lbs->el_index[i].message_id;
|
||||||
|
|
||||||
eprintf("Warning: Entry #%d is new locally and remotely, will not be retrieved\n", message_id);
|
for (i = 0; i < n_remote; i++)
|
||||||
|
if (md5_remote[i].message_id > max_id)
|
||||||
|
max_id = md5_remote[i].message_id;
|
||||||
|
|
||||||
|
if (_logging_level > 1)
|
||||||
|
write_logfile(lbs, "MIRROR change entry #%d to #%d", message_id, max_id + 1);
|
||||||
|
|
||||||
|
/* rearrange local message not to conflict with remote message */
|
||||||
|
if (!getcfg(lbs->name, "Mirror simulate", str, sizeof(str))
|
||||||
|
|| atoi(str) == 0) {
|
||||||
|
el_move_message(lbs, message_id, max_id + 1);
|
||||||
|
|
||||||
|
sprintf(str, "ID%d:\t", message_id);
|
||||||
|
sprintf(str + strlen(str), loc("Changed local entry ID to %d"), max_id + 1);
|
||||||
|
mprint(lbs, mode, str);
|
||||||
|
|
||||||
|
/* current message has been changed, so start over */
|
||||||
|
i_msg--;
|
||||||
} else {
|
} else {
|
||||||
|
sprintf(str, "ID%d:\t", message_id);
|
||||||
/* find max id both locally and remotely */
|
sprintf(str + strlen(str), loc("Local entry ID should be changed to %d"), max_id + 1);
|
||||||
max_id = 1;
|
mprint(lbs, mode, str);
|
||||||
for (i = 0; i < *lbs->n_el_index; i++)
|
|
||||||
if (lbs->el_index[i].message_id > max_id)
|
|
||||||
max_id = lbs->el_index[i].message_id;
|
|
||||||
|
|
||||||
for (i = 0; i < n_remote; i++)
|
|
||||||
if (md5_remote[i].message_id > max_id)
|
|
||||||
max_id = md5_remote[i].message_id;
|
|
||||||
|
|
||||||
if (_logging_level > 1)
|
|
||||||
write_logfile(lbs, "MIRROR change entry #%d to #%d", message_id, max_id + 1);
|
|
||||||
|
|
||||||
/* rearrange local message not to conflict with remote message */
|
|
||||||
if (!getcfg(lbs->name, "Mirror simulate", str, sizeof(str))
|
|
||||||
|| atoi(str) == 0) {
|
|
||||||
el_move_message(lbs, message_id, max_id + 1);
|
|
||||||
|
|
||||||
sprintf(str, "ID%d:\t", message_id);
|
|
||||||
sprintf(str + strlen(str), loc("Changed local entry ID to %d"), max_id + 1);
|
|
||||||
mprint(lbs, mode, str);
|
|
||||||
|
|
||||||
/* current message has been changed, so start over */
|
|
||||||
i_msg--;
|
|
||||||
} else {
|
|
||||||
sprintf(str, "ID%d:\t", message_id);
|
|
||||||
sprintf(str + strlen(str), loc("Local entry ID should be changed to %d"), max_id + 1);
|
|
||||||
mprint(lbs, mode, str);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12773,50 +12770,49 @@ void synchronize_logbook(LOGBOOK * lbs, int mode, BOOL sync_all)
|
|||||||
|
|
||||||
all_identical = FALSE;
|
all_identical = FALSE;
|
||||||
|
|
||||||
if (mode != SYNC_CLONE) {
|
if (!isparam("confirm") && mode == SYNC_HTML) {
|
||||||
|
|
||||||
if (!isparam("confirm") && mode == SYNC_HTML) {
|
combine_url(lbs, list[index], "", str, sizeof(str));
|
||||||
|
sprintf(rem_ref, "<a href=\"http://%s%d\">%s</a>", str,
|
||||||
|
message_id, loc("Remote entry"));
|
||||||
|
|
||||||
combine_url(lbs, list[index], "", str, sizeof(str));
|
sprintf(str, loc("%s should be deleted"), rem_ref);
|
||||||
sprintf(rem_ref, "<a href=\"http://%s%d\">%s</a>", str,
|
rsprintf("ID%d:\t%s\n", message_id, str);
|
||||||
message_id, loc("Remote entry"));
|
n_delete++;
|
||||||
|
|
||||||
sprintf(str, loc("%s should be deleted"), rem_ref);
|
} else if (!isparam("confirm") && mode == SYNC_CLONE) {
|
||||||
rsprintf("ID%d:\t%s\n", message_id, str);
|
|
||||||
n_delete++;
|
|
||||||
|
|
||||||
}
|
sprintf(str, "ID%d:\t%s", message_id, loc("Entry should be deleted remotely"));
|
||||||
|
mprint(lbs, mode, str);
|
||||||
|
|
||||||
if (isparam("confirm") || mode == SYNC_CRON) {
|
} else {
|
||||||
|
|
||||||
if (_logging_level > 1)
|
if (_logging_level > 1)
|
||||||
write_logfile(lbs, "MIRROR delete remote entry #%d", message_id);
|
write_logfile(lbs, "MIRROR delete remote entry #%d", message_id);
|
||||||
|
|
||||||
sprintf(str, "%d?cmd=%s&confirm=%s", message_id, loc("Delete"), loc("Yes"));
|
sprintf(str, "%d?cmd=%s&confirm=%s", message_id, loc("Delete"), loc("Yes"));
|
||||||
combine_url(lbs, list[index], str, url, sizeof(url));
|
combine_url(lbs, list[index], str, url, sizeof(url));
|
||||||
|
|
||||||
if (!getcfg(lbs->name, "Mirror simulate", str, sizeof(str))
|
if (!getcfg(lbs->name, "Mirror simulate", str, sizeof(str))
|
||||||
|| atoi(str) == 0) {
|
|| atoi(str) == 0) {
|
||||||
retrieve_url(url, &buffer, NULL);
|
retrieve_url(url, &buffer, NULL);
|
||||||
|
|
||||||
if (strstr(buffer, "Location: ")) {
|
if (strstr(buffer, "Location: ")) {
|
||||||
if (mode == SYNC_HTML)
|
if (mode == SYNC_HTML)
|
||||||
rsprintf("ID%d:\t%s\n", message_id, loc("Entry deleted remotely"));
|
rsprintf("ID%d:\t%s\n", message_id, loc("Entry deleted remotely"));
|
||||||
} else {
|
|
||||||
|
|
||||||
if (mode == SYNC_HTML && isparam("debug"))
|
|
||||||
rsputs(buffer);
|
|
||||||
|
|
||||||
mprint(lbs, mode, loc("Error deleting remote entry"));
|
|
||||||
}
|
|
||||||
|
|
||||||
xfree(buffer);
|
|
||||||
} else {
|
} else {
|
||||||
sprintf(str, "ID%d:\t%s", message_id, loc("Entry should be deleted remotely"));
|
|
||||||
mprint(lbs, mode, str);
|
if (mode == SYNC_HTML && isparam("debug"))
|
||||||
|
rsputs(buffer);
|
||||||
|
|
||||||
|
mprint(lbs, mode, loc("Error deleting remote entry"));
|
||||||
}
|
}
|
||||||
|
|
||||||
md5_cache[i_cache].message_id = -1;
|
md5_cache[i_cache].message_id = -1;
|
||||||
|
xfree(buffer);
|
||||||
|
} else {
|
||||||
|
sprintf(str, "ID%d:\t%s", message_id, loc("Entry should be deleted remotely"));
|
||||||
|
mprint(lbs, mode, str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -21182,7 +21178,7 @@ int run_service(void)
|
|||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i, j, n, fh, tcp_port_cl, silent;
|
int i, j, n, fh, tcp_port_cl, silent, sync_flag;
|
||||||
char read_pwd[80], write_pwd[80], admin_pwd[80], str[256], logbook[256],
|
char read_pwd[80], write_pwd[80], admin_pwd[80], str[256], logbook[256],
|
||||||
clone_url[256], error_str[256], file_name[256];
|
clone_url[256], error_str[256], file_name[256];
|
||||||
time_t now;
|
time_t now;
|
||||||
@ -21204,7 +21200,7 @@ int main(int argc, char *argv[])
|
|||||||
/* initialize variables */
|
/* initialize variables */
|
||||||
read_pwd[0] = write_pwd[0] = admin_pwd[0] = logbook[0] = clone_url[0] = 0;
|
read_pwd[0] = write_pwd[0] = admin_pwd[0] = logbook[0] = clone_url[0] = 0;
|
||||||
logbook_dir[0] = resource_dir[0] = logbook_dir[0] = 0;
|
logbook_dir[0] = resource_dir[0] = logbook_dir[0] = 0;
|
||||||
silent = tcp_port_cl = 0;
|
silent = tcp_port_cl = sync_flag = 0;
|
||||||
use_keepalive = TRUE;
|
use_keepalive = TRUE;
|
||||||
running_as_daemon = FALSE;
|
running_as_daemon = FALSE;
|
||||||
|
|
||||||
@ -21244,6 +21240,10 @@ int main(int argc, char *argv[])
|
|||||||
use_keepalive = FALSE;
|
use_keepalive = FALSE;
|
||||||
else if (argv[i][0] == '-' && argv[i][1] == 'x')
|
else if (argv[i][0] == '-' && argv[i][1] == 'x')
|
||||||
enable_execute = TRUE;
|
enable_execute = TRUE;
|
||||||
|
else if (argv[i][0] == '-' && argv[i][1] == 'm')
|
||||||
|
sync_flag = 1;
|
||||||
|
else if (argv[i][0] == '-' && argv[i][1] == 'M')
|
||||||
|
sync_flag = 2;
|
||||||
else if (argv[i][1] == 't') {
|
else if (argv[i][1] == 't') {
|
||||||
time(&now);
|
time(&now);
|
||||||
tms = localtime(&now);
|
tms = localtime(&now);
|
||||||
@ -21308,6 +21308,8 @@ int main(int argc, char *argv[])
|
|||||||
printf(" -a <pwd> create/overwrite admin password in config file\n");
|
printf(" -a <pwd> create/overwrite admin password in config file\n");
|
||||||
printf(" -c <file> specify configuration file\n");
|
printf(" -c <file> specify configuration file\n");
|
||||||
printf(" -C <url> clone remote elogd configuration\n");
|
printf(" -C <url> clone remote elogd configuration\n");
|
||||||
|
printf(" -m synchronize logbook(s) with remote server\n");
|
||||||
|
printf(" -M synchronize with removing deleted entries\n");
|
||||||
printf(" -D become a daemon\n");
|
printf(" -D become a daemon\n");
|
||||||
printf(" -d <dir> specify logbook root directory\n");
|
printf(" -d <dir> specify logbook root directory\n");
|
||||||
#ifdef OS_UNIX
|
#ifdef OS_UNIX
|
||||||
@ -21315,7 +21317,7 @@ int main(int argc, char *argv[])
|
|||||||
#endif
|
#endif
|
||||||
printf(" -h this help\n");
|
printf(" -h this help\n");
|
||||||
printf(" -k do not use keep-alive\n");
|
printf(" -k do not use keep-alive\n");
|
||||||
printf(" -l <logbook> specify logbook for -r and -w commands\n");
|
printf(" -l <logbook> specify logbook for -r, -w and -m commands\n");
|
||||||
printf(" -n <hostname> TCP/IP hostname\n");
|
printf(" -n <hostname> TCP/IP hostname\n");
|
||||||
printf(" -p <port> TCP/IP port\n");
|
printf(" -p <port> TCP/IP port\n");
|
||||||
printf(" -r <pwd> create/overwrite read password in config file\n");
|
printf(" -r <pwd> create/overwrite read password in config file\n");
|
||||||
@ -21456,6 +21458,28 @@ int main(int argc, char *argv[])
|
|||||||
&& logbook_dir[strlen(logbook_dir) - 1] != DIR_SEPARATOR)
|
&& logbook_dir[strlen(logbook_dir) - 1] != DIR_SEPARATOR)
|
||||||
strlcat(logbook_dir, DIR_SEPARATOR_STR, sizeof(logbook_dir));
|
strlcat(logbook_dir, DIR_SEPARATOR_STR, sizeof(logbook_dir));
|
||||||
|
|
||||||
|
if (sync_flag) {
|
||||||
|
el_index_logbooks();
|
||||||
|
|
||||||
|
if (sync_flag == 2)
|
||||||
|
setparam("confirm", "yes");
|
||||||
|
|
||||||
|
if (logbook[0]) {
|
||||||
|
for (i=0 ; lb_list[i].name[0] ; i++)
|
||||||
|
if (stricmp(lb_list[i].name, logbook))
|
||||||
|
break;
|
||||||
|
if (!lb_list[i].name[0]) {
|
||||||
|
eprintf("Logbook \"%s\" not defined in configuration file\n", logbook);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
synchronize(&lb_list[i], SYNC_CLONE);
|
||||||
|
} else
|
||||||
|
synchronize(NULL, SYNC_CLONE);
|
||||||
|
|
||||||
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
if (clone_url[0]) {
|
if (clone_url[0]) {
|
||||||
|
|
||||||
/* force re-read of config file */
|
/* force re-read of config file */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user