laurent22 / rsync-time-backup

Time Machine style backup with rsync.
3.38k stars 446 forks source link

Cron friendly #184

Open prontog opened 4 years ago

prontog commented 4 years ago

Hello and thanks for this very useful tool!

Regarding #181, I made a couple changes that under circumstances always wrote to STDERR. This is a problem with cron where you usually redirect STDOUT to /dev/null but want to keep STDERR as is so that you get an email notification when a warning or error occurs.

The first change was with the df check on SRC_FOLDER right after the trailling / is stripped. In the case of SRC_FOLDER == / , the / was stripped and df wrote to STDERR because FILE was the empty string.

The second change was the -o UserKnownHostsFile=/dev/null fixed ssh argument. This lead to ssh always writing to STDERR. This is part of #128. I would expect people to first setup the ssh access and then use rsync_tmbackup.sh. I cant' see a reason in bypassing the local configuration by default. There is always the -e option of rsync which can be used to set ssh options.

Best regards,

Panos

kapitainsky commented 4 years ago

Regarding #181 - I have just tested and it fails. But reason is not your fix but original #170 - df -T works different on macOS. To keep this script cross platform it should be reworked.

as per man df:

 -T      Only print out statistics for filesystems of the specified types.  More than one type may be specified in a comma separated list.  The list of
         filesystem types can be prefixed with ``no'' to specify the filesystem types for which action should not be taken.  For example, the df command:

               df -T nonfs,mfs

         lists all filesystems except those of type NFS and MFS.  The lsvfs(1) command can be used to find out the types of filesystems that are available on
         the system.

It means that as it is now does not work on macOS.

prontog commented 4 years ago

Is it necessary to add this fix in this PR (I have no access to a Mac)?

As you say it has to do with #170. GNU df prints the fs type with -T.

kapitainsky commented 4 years ago

I think course of action is up to @laurent22 and @omer-musa-battal who created PR for #170