From 369e8426a2ba818eb65938dfe42ebb2573ef372f Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Mon, 20 Dec 2021 23:42:57 +0000 Subject: [PATCH] rsync docm updates --- handbook/computing/qstart-rsync.html | 29 +++++++++++++++++++++------- handbook/troggle/scriptsother.html | 8 +++++++- handbook/troggle/trogkill.html | 2 +- scripts/updatephotos | 14 ++++++++++++++ 4 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 scripts/updatephotos diff --git a/handbook/computing/qstart-rsync.html b/handbook/computing/qstart-rsync.html index 8e38bdbab..577b5fddc 100644 --- a/handbook/computing/qstart-rsync.html +++ b/handbook/computing/qstart-rsync.html @@ -26,28 +26,43 @@ uploading photographs: uploading.html.

To sync all the files from the server to your local expofiles directory on your laptop:

-

rsync -nazv --delete-after --exclude="thumbs/" --exclude="*.???.xml" --exclude="*.jpeg.xml" expo@expo.survex.com:expofiles/ /home/expo/expofiles

+
rsync -nazv --delete-after --exclude="thumbs/" --exclude="*.???.xml" --exclude="*.jpeg.xml" expo@expo.survex.com:expofiles/ /home/expo/expofiles

To sync the local expofiles directory back to the server after you have edited updates (e.g. scanned some hand-drawn surveys into expofiles/surveyscans/ (but only if your machine runs Linux):

-

rsync -nazv --delete-after /home/expo/expofiles/surveyscans/2019/ expo@expo.survex.com:expofiles/surveyscans/2019

+
rsync -nazv --delete-after /home/expo/expofiles/surveyscans/2019/ expo@expo.survex.com:expofiles/surveyscans/2019
then CHECK that the list of files it produces matches the ones you absolutely intend to delete forever! ONLY THEN do it without the "-n" option. "-n" is the same as "--dry-run" which shows you the overwriting changes but doesn't actually do them. -

Always +

Note that the target folder has no trailing slash but that the source folder does. Important. + +

Always:

-

(do be incredibly careful not to delete piles of stuff then rsync back, or to get the directory level of the command wrong - as it'll all get deleted on the server too, and we may not have backups!). It's absolutely vital to use rsync --dry-run --delete-after first to check what would be deleted. +

(do be incredibly careful not to delete piles of stuff then rsync back, or to get the directory level of the command wrong - as it'll all get deleted on the server too, and we will not have backups if these are recent files!). It's absolutely vital to use rsync --dry-run --delete-after first to check what would be deleted. +

If your version of rsync produces output for every folder it sees, even if it is not update, then pipe the output through +

| grep -v "/$"
+to hide the folders which have a termial slash. -

If you are using rsync from an NTFS folder on a Windows machine (even if you are using WSL to do it) you will not get all the files for certain as some Linux filenames are incompatible with Windows. What will happen is that rsync will invisibly change the names as it downloads them from the Linux expo server to your Windows machine, but then it forgets what it has done and tries to re-upload all the renamed files to the server even if you have touched none of them. This pollutes the server. Now there won't be any problems with simple filenames using all lowercase letters and no funny characters, but we have nothing in place to stop anyone creating an incompatible filename of that sort somewhere in that 40GB or of detecting the problem at the time. So don't do it. Be extra, extra careful and religiously use the -n (DRY RUN) setting and manually check all changes before running rsync without -n. +

If you are using rsync from an NTFS folder on a Windows machine (even if you are using WSL to do it) you will not necessarily get all the files cleanly as some legal Linux filenames are incompatible with Windows. What will happen is that +

    +
  1. rsync will invisibly change the names as it downloads them from the Linux expo server to your Windows machine, but +
  2. then it forgets what it has done and +
  3. when you next try to rsynchronise using rsync, it will +
  4. re-upload all the renamed files and maybe delete the originals even if you have touched none of them. +
  5. This pollutes the server and would break links between survex files and drawings file. +
Now there won't be any problems with simple filenames using all lowercase letters and no funny characters (except for "con.jpg" and similar of course*), but we have nothing in place to stop anyone creating (using Linux) an incompatible filename of that sort somewhere in that 40GB or of detecting the problem at the time. So be extra, extra careful and religiously use the -n (DRY RUN) setting and manually check all changes before running rsync without -n.

(We may also have an issue with rsync not using the appropriate user:group attributes for files pushed back to the server. This may not cause any problems, but watch out for it.)

+

* CON is an MS-DOS identifier for the CONSOLE and it is still an illegal Windows filename. +It's not the only thing like that. diff --git a/handbook/troggle/scriptsother.html b/handbook/troggle/scriptsother.html index a5440b850..f675c8ad2 100644 --- a/handbook/troggle/scriptsother.html +++ b/handbook/troggle/scriptsother.html @@ -40,7 +40,13 @@

There are also scripts running cron jobs on the server to fix file permissions and to periodically tidy repositories, and example rsync and scp scripts to help manage synchronisation of the expofiles directories which are not under version control. -

Apart from these scripts, troggle in full deployment on the server also needs
- a running mySQL database,
- a running apache webserver and
- cgit to display git repos. +

Apart from these scripts, troggle in full deployment on the server also needs (at least) +
- a mySQL database, +
- a webserver such as apache +
- a text seach utility such as xapian +
- cgit to display git repos. +

See the server configuration for the full list, +or the smaller troggle dev setup for just core software development.

Old but maybe useful scripts