";
+
+ print '';
+ print "";
+ open (INF,"/tmp/recentrsync")
+ or die ("can't open rsync log file: $1");
+
+ while ()
+ {
+ print "$_";
+ }
+
+ close INF;
+ print "
\n";
+ }
+
+ print '';
+ print '';
+ print $q->endform;
+ print $q->p ($q->hr, $q->font ({size => "-1"}, "Copyright dungog.net",
+ $q->a ({href => $q->url (-absolute => 1) . "?state=help"}, 'Rsync help'), " ..."));
+
+ print '';
+ print '';
+ print $q->end_html;
+
+}
+
+sub showHelp ($)
+{
+ my ($q) = @_;
+
+ esmith::cgi::genHeaderNonCacheable
+ ($q, \%conf, 'Rsync Help');
+
+ print $q->startform (-method => 'POST',
+ -action => $q->url (-absolute => 1));
+
+ print $q->table ({border => 0, cellspacing => 0, cellpadding => 4},
+
+ esmith::cgi::genTextRow ($q, $q->p ('
+* General
+* Secure rsync
+* SSH keys
+* Changing the port
+* Rsync Anonymous server
+* Rsync Anonymous client
+* Exclude / Include syntax
+* Advanced
+
+General
+Transfer files between your sme server and other servers with ssh and rsync installed.
+Automate the process using a secure ssh connection.
+Distribute to or collect data from other servers automatically.
+
+Secure rsync
+Safeguards
+To prevent server resources being overused only one rsync job is
+permitted to run at once, this can be overridden with the db command
+db dungog setprop rsync overlap allow
+
+Emails to admin warn of this and other errors, and advise of success, please check for them.
+
+Method
+For multiple directory or server transfers it could get very confusing,
+so only enter multiple entries for one catagory, if you enter extra entries
+only one is used. See the advanced section below for workarounds
+
+Notes
+You can transfer a single file instead of a directory.
+Enclose directories or filenames that include spaces with a double quote
+
+Save the panel settings in stages, it is frustrating to have to re-enter data
+when you get an error becasue your local path/filename is wrong
+
+Remember to remove the extra server or directory record after using the copy&Edit... link
+
+Rsync will attempt to transfer data at the I/O bandwith rate,
+the actual rate depends on network traffic and hardware
+
+SSH Keys
+To automate the transfer you need to establish a secure connection
+without being prompted for a password. To connect with ssh to the user
+on a remote server you need to place the public key of whichever user
+you are using on this server into ~/.ssh/authorized_keys on the remote user/server.
+
+cd /home/e-smith/files/users/dummy/.ssh
+ssh-keygen -t rsa [accept file name id_rsa][don\'t enter a passphrase]
+ssh dummy@remote-server.net mkdir .ssh
+scp id_rsa.pub dummy@remote-server.net:.ssh/dummy.localserver.pub
+ssh dummy@remote-server.net
+cd .ssh
+cat dummy.localserver.pub >> authorized_keys
+[or for the first key
+scp id_rsa.pub dummy@remote-server.net:.ssh/authorized_keys ]
+
+now you should be able to "ssh dummy@remote-server.net" without a passord prompt
+
+Changing the port
to connect to a remote server
+
+dungog-rsync and dungog-backup
+can use a db setting to find the ssh port of your remote servers
+
+set the port for any server with the following commands
+
+run this once
+# /sbin/e-smith/db dungog set remoteport setting
+
+then for each server add a matching server entry
+# /sbin/e-smith/db dungog setprop remoteport root@mail.server2.com 2211
+
+verify
+# /sbin/e-smith/db dungog show remoteport
+ remoteport=setting
+ root@mail.server2.com=2211
+ root@www.server3.com=2212
+
+Rsync Anonymous server TODO
+Highly experimental - do not use
+
+This used to require e-smith-rsyncd but you can now get rsyncd
+functionality via the smeserver-shared-folders contrib
+
+To make files available for download by Anonymous Rsync you place them
+in the files directory of an ibay and make it globally accesable.
+The panel shows which servers have the correct settings and warns of
+possible errors in permissions. It has an option to enable or disable
+anonymous rsync access.
+
+
+Rsync Anonymous client
+
+Used to pull files from an anonymous rsync server
+
+Exclude / Include syntax
+
+here is a simple example
+# cat /opt/rsync55622.ex
+/home/e-smith/files/ibays/backup/
+*.bak
+
+Note. the exlude file is matched first
+From man rsync
+
+ --exclude-from=FILE
+ This option allows you to selectively exclude cer-
+ tain files from the list of files to be trans-
+ ferred. This is most useful in combination with a
+ recursive transfer.
+
+ This option adds all exclude patterns listed in the
+ file FILE to the exclude list. Blank lines in FILE
+ and lines starting with ";" or "#" are ignored. If
+ FILE is - the list will be read from standard
+ input.
+
+EXCLUDE PATTERNS
+ The exclude and include patterns specified to rsync allow
+ for flexible selection of which files to transfer and
+ which files to skip.
+
+ rsync builds an ordered list of include/exclude options as
+ specified on the command line. When a filename is encoun-
+ tered, rsync checks the name against each exclude/include
+ pattern in turn. The first matching pattern is acted on.
+ If it is an exclude pattern, then that file is skipped. If
+ it is an include pattern then that filename is not
+ skipped. If no matching include/exclude pattern is found
+ then the filename is not skipped.
+
+ Note that when used with -r (which is implied by -a),
+ every subcomponent of every path is visited from top down,
+ so include/exclude patterns get applied recursively to
+ each subcomponent.
+
+ The patterns can take several forms. The rules are:
+
+ o if the pattern starts with a / then it is matched
+ against the start of the filename, otherwise it is
+ matched against the end of the filename. Thus
+ "/foo" would match a file called "foo" at the base
+ of the tree. On the other hand, "foo" would match
+ any file called "foo" anywhere in the tree because
+ the algorithm is applied recursively from top down;
+ it behaves as if each path component gets a turn at
+ being the end of the file name.
+
+ o if the pattern ends with a / then it will only
+ match a directory, not a file, link or device.
+
+ o if the pattern contains a wildcard character from
+ the set *?[ then expression matching is applied
+ using the shell filename matching rules. Otherwise
+ a simple string match is used.
+
+ o if the pattern includes a double asterisk "**" then
+ all wildcards in the pattern will match slashes,
+ otherwise they will stop at slashes.
+
+ o if the pattern contains a / (not counting a trail-
+ ing /) then it is matched against the full file-
+ name, including any leading directory. If the pat-
+ tern does not contain a / then it is matched only
+ against the final component of the filename.
+ Again, remember that the algorithm is applied
+ recursively so "full filename" can actually be any
+ portion of a path.
+
+ o if the pattern starts with "+ " (a plus followed by
+ a space) then it is always considered an include
+ pattern, even if specified as part of an exclude
+ option. The "+ " part is discarded before matching.
+
+ o if the pattern starts with "- " (a minus followed
+ by a space) then it is always considered an exclude
+ pattern, even if specified as part of an include
+ option. The "- " part is discarded before matching.
+
+ o if the pattern is a single exclamation mark ! then
+ the current include/exclude list is reset, removing
+ all previously defined patterns.
+
+ The +/- rules are most useful in exclude lists, allowing
+ you to have a single exclude list that contains both
+ include and exclude options.
+
+ If you end an exclude list with --exclude "*", note that
+ since the algorithm is applied recursively that unless you
+ explicitly include parent directories of files you want to
+ include then the algorithm will stop at the parent direc
+ tories and never see the files below them. To include all
+ directories, use --include "*/" before the --exclude "*".
+
+ Here are some exclude/include examples:
+
+ o *.o would exclude all filenames
+ matching *.o
+
+ o /foo would exclude a file in the base
+ directory called foo
+
+ o "foo/" would exclude any directory called
+ foo
+
+ o /foo/*/bar would exclude any file
+ called bar two levels below a base directory called
+ foo
+
+ o /foo/**/bar would exclude any file
+ called bar two or more levels below a base direc-
+ tory called foo
+
+ o */
+ *.c
+ * would
+ include all directories and C source files
+
+ o foo/
+ foo/bar.c
+ * would include only foo/bar.c (the foo/ direc-
+ tory must be explicitly included or it would be
+ excluded by the "*")
+
+Advanced
+
+Not all rsync options can be applied with the panel, if you have
+a need to further refine your script you can
+
+1.
+the panel creates shell scripts in /usr/bin/ called dungogrsync-rsync*
+eg.
+-rwxr-xr-x 1 cathie admin 467 Sep 30 21:34 /usr/bin/dungogrsync-rsync55622
+-rwxr-xr-x 1 stephen admin 593 Oct 1 01:28 /usr/bin/dungogrsync-rsync608624
+
+2.
+if automated, these are called from cron
+
+3.
+you can take these files,
+copy and/or combine them into a new files so they are not overwritten
+then add the new file into cron, eg with dungog-cron.
+
+* combining the files will let one job finish before a new one starts
+
+* you can add other options,
+either generate a dummy script with the panel to check syntax,
+or read the manual, man rsync or google
+
+
')));
+
+ print $q->endform;
+ print $q->p ($q->hr, $q->font ({size => "-1"}, "Copyright dungog.net",
+ $q->a ({href => $q->url (-absolute => 1) . ""}, 'Return to main'), " ..."));
+ return;
+}
\ No newline at end of file
diff --git a/smeserver-rsync.spec b/smeserver-rsync.spec
new file mode 100644
index 0000000..b64f622
--- /dev/null
+++ b/smeserver-rsync.spec
@@ -0,0 +1,151 @@
+%define name smeserver-rsync
+%define version 1.3
+%define release 5
+Summary: SMEserver rpm for rsync
+Name: %{name}
+Version: %{version}
+Release: %{release}
+License: GNU GPL version 2
+URL: http://www.contribs.org
+Distribution: SME Server
+Group: SMEServer/addon
+Source: %{name}-%{version}.tar.xz
+Packager: Stephen Noble
+BuildRoot: /var/tmp/%{name}-%{version}
+BuildArchitectures: noarch
+BuildRequires: e-smith-devtools
+Requires: e-smith-release >= 9
+AutoReqProv: no
+
+
+%description
+SMEserver rpm for setting up rsync jobs with a server panel
+
+%changelog
+* Thu Oct 09 2025 cvs2git.sh aka Brian Read 1.3-5.sme
+- Roll up patches and move to git repo [SME: 12338]
+
+* Thu Oct 09 2025 BogusDateBot
+- Eliminated rpmbuild "bogus date" warnings due to inconsistent weekday,
+ by assuming the date is correct and changing the weekday.
+ Thu Apr 17 2018 --> Thu Apr 12 2018 or Tue Apr 17 2018 or Thu Apr 19 2018 or ....
+
+* Fri Sep 06 2024 Terry Fage 1.3-4.sme
+- add locale 2024-03-21.patch
+
+* Mon Dec 28 2020 Brian Read 1.3-3.sme
+- Initial import to SME10 [SME: ]
+
+* Tue Apr 17 2018 John Crisp
+ Thu Apr 17 2018 --> Thu Apr 12 2018 or Tue Apr 17 2018 or Thu Apr 19 2018 or ....
+- Set default Options to test
+- Fix spelling 'recieve'
+- Set default status to Test
+- Modify wording [SME:9684]
+- [1.3-2]
+
+* Thu Apr 21 2016 John Crisp
+- First import to smecontribs
+
+* Thu Jun 8 2006 Stephen Noble
+- db option to allow overlaps, db dungog setprop rsync overlap allow
+- suggestion added to automate with dungog-cron
+- panel simplified, instructions moved to help
+- [1.2-7]
+
+* Tue Jun 6 2006 Stephen Noble
+- terminate new jobs if rsync is already running
+- [1.2-6]
+
+* Wed Apr 5 2006 Stephen Noble
+- add include and exclude directories for 'rsync to self'
+- [1.2-5]
+
+* Mon Mar 27 2006 Stephen Noble
+- expand crontab on saves
+- remote is now user@server.net not just server.net
+- [1.2-4]
+
+* Tue Mar 14 2006 Stephen Noble
+- fixed incorrect crontab permissions
+- [1.2-3]
+
+* Mon Oct 24 2005 Stephen Noble
+- more bandwidth options
+- help, Advanced options
+- [1.2-2]
+
+* Thu Sep 15 2005 Stephen Noble
+- option to run every 2,4,8,12 hours
+- [1.2-1]
+
+* Thu Aug 11 2005 Stephen Noble
+- sme 7 version
+- [1.0-7]
+
+* Thu Aug 29 2002 Stephen Noble
+- initial release
+- [0.1-1]
+
+
+%prep
+%setup
+
+
+%build
+perl createlinks
+
+
+%install
+rm -rf $RPM_BUILD_ROOT
+(cd root ; find . -depth -print | cpio -dump $RPM_BUILD_ROOT)
+/sbin/e-smith/genfilelist $RPM_BUILD_ROOT > %{name}-%{version}-filelist
+echo "%doc " >> %{name}-%{version}-filelist
+
+%clean
+cd ..
+rm -rf %{name}-%{version}
+
+%pre
+%preun
+%post
+#new installs
+if [ $1 = 1 ] ; then
+ /bin/touch /home/e-smith/db/dungog
+
+# DBS=`find /home/e-smith/db/navigation -type f -name "navigation.*"`
+# for db in $DBS ; do
+# /sbin/e-smith/db $db set dungog-rsync panel Description "Rsync" DescriptionWeight 4863 Heading "dungog.net" HeadingWeight 4000 2>/dev/null
+# done
+fi
+
+/bin/chmod 644 /etc/crontab
+/etc/e-smith/events/actions/initialize-default-databases
+
+echo ''
+echo 'Remote server syntax changed for secure transfers from dungog-rsync-1.2-4'
+echo 'you now need to enter the user as well as the server'
+echo 'this removes the requirement of having the same user on both servers'
+echo 'but you may need to update your existing rules'
+echo ''
+
+
+%postun
+#uninstalls
+if [ $1 = 0 ] ; then
+ /sbin/e-smith/expand-template /etc/crontab
+
+ /bin/rm -rf /usr/bin/dungogrsync-?????
+
+# DBS=`find /home/e-smith/db/navigation -type f -name "navigation.*"`
+# for db in $DBS ; do
+# /sbin/e-smith/db $db delete dungog-rsync 2>/dev/null
+# done
+
+fi
+
+#&upgrades
+
+
+%files -f %{name}-%{version}-filelist
+%defattr(-,root,root)