msynk/msynk.1.man
2022-04-08 01:56:55 +02:00

239 lines
6.9 KiB
Groff

.\" Automatically generated by Pandoc 2.17.0.1
.\"
.TH "MSYNK" "1" "March 2022" "msynk 1.1" ""
.hy
.SH NAME
.PP
\f[B]msynk\f[R] - rsync helper that supports encryption and presets
.SH SYNOPSIS
.PP
Local:
.PD 0
.P
.PD
\ \ \ \f[B]msynk\f[R] [OPTION\&...]
-r DEST_DIR -s SOURCE_DIR PATHS\&...
.PP
Via remote shell:
.PD 0
.P
.PD
\ \ \ \ Push:
.PD 0
.P
.PD
\ \ \ \ \ \ \ \ \f[B]msynk\f[R] [OPTION\&...]
-r [USER\[at]]HOST:DEST_DIR -s SOURCE_DIR PATHS\&...
.PD 0
.P
.PD
\ \ \ \ Pull:
.PD 0
.P
.PD
\ \ \ \ \ \ \ \ \f[B]msynk\f[R] [OPTION\&...]
-r DEST_DIR -s [USER\[at]]HOST:SOURCE_DIR PATHS\&...
.PP
Using a configuration file:
.PD 0
.P
.PD
\ \ \ \ \f[B]msynk\f[R] [OPTION\&...]
-c CONFIG NAME [SELECTIONS\&...]
.SH DESCRIPTION
.PP
\f[B]msynk\f[R] uses \f[I]rsync\f[R] to synchronise files or directories
locally or between devices.
In general, you should always add a trailing `/' to directories.
.SS Encryption
.PP
Files can also be encrypted or decrypted using \f[I]mkrypt\f[R].
If encryption is used, the files are encrypted to a temporary directory
and then synced with \f[I]rsync\f[R].
If you sync encrypted files to your system, the encrypted files are
transferred with \f[I]rsync\f[R] to a temporary directory and then
decrypted to your filesystem.
.SS Configuration Files
.PP
\f[B]msynk\f[R] can read from config files usually stored in
\[ti]/.config/msynk.
The config files are shellscripts run with bash to set certain
environent variables.
These are:
.PD 0
.P
.PD
- paths: array containing all paths (relative to sender) that should be
synced
.PD 0
.P
.PD
- sender: the parent directory of the paths
.PD 0
.P
.PD
- receiver: the path where the files should be synced to
.PD 0
.P
.PD
- rsync_flags: array containing all the flags for rsync.
If you just want to add a flag, use rsync_flags+=(-yourflag)
.PD 0
.P
.PD
- use_encryption: 0 for no, 1 for yes\ A template config file is stored
in /usr/share/msynk.
You can change the location of the configuration directory by replacing
$CONFIG_DIR with your directory in /usr/bin/msynk
.SS Example
.PP
To sync the directories \[lq]/home/user/foo\[rq]
\[lq]/home/user/bar\[rq] and the file \[lq]/home/user/file.txt\[rq] to a
remote server \[lq]user\[at]foobar.com:\[ti]/backup\[rq] which is
available with ssh at port 42, you could have a configuration file
\[lq]my_backup\[rq]:
.PD 0
.P
.PD
sender=/home/user/
.PD 0
.P
.PD
receiver=user\[at]foobar.com:\[ti]/backup/
.PD 0
.P
.PD
paths=(foo/ bar/ file.txt)
.PD 0
.P
.PD
rsync_flags+=(\[em]-rsh=\[lq]ssh -p 42\[rq])
.PD 0
.P
.PD
You can then run this with: \[lq]msynk -c my_backup\[rq], or if you only
want to sync the \[lq]foo\[rq] directory and \[lq].txt\[rq] files:
\[lq]msynk -c my_backup foo .txt\[rq]
.SH OPTIONS
.TP
\f[B]-h\f[R], \f[B]\[em]-help\f[R]
Show a list of arguments.
.TP
\f[B]\[em]-settings\f[R]
Show the current settings.
.TP
\f[B]-c\f[R], \f[B]\[em]-config\f[R] config-name
Retrieve settings from a config file in $CONFIG_DIR, eg
\[ti]/.config/msynk/\f[I]config-name\f[R]
.TP
\f[B]\[em]-show-config\f[R] config-name
Print variables defined from a config with \f[I]config-name\f[R].
.TP
\f[B]-s\f[R], \f[B]\[em]-sender\f[R] path
Set sender to directory.
This can also be a remote, like user\[at]domain.com:/dir.
Defaults to to the current working directory.
.TP
\f[B]-r\f[R], \f[B]\[em]-receiver\f[R] path
Set the receiver directory.
All files and directories will be placed inside this directory.
This can also be a remote, like user\[at]domain.com:/dir.
This option always needs to be set.
Note that this directory must already exist if it is on a remote.
.TP
\f[B]\[em]-reverse\f[R]
Swaps sender and receiver.
Useful when you want to reverse a config file.
.TP
\f[B]\[em]-encrypt\f[R]
Encrypt files with \f[I]mkrypt\f[R] before sending them to the receiver.
The files are encrypted to $TMP_DIR and then synced to the receiver.
Does not work with \[em]-delete.
.TP
\f[B]\[em]-decrypt\f[R]
Decrypt files with \f[I]mkrypt\f[R] after receiving them from the
sender.
Assumes that all files are encrypted and fails if that is not the case.
The files are synced to $TMP_DIR and then decrypted to the receiver
directory.
Does not work with \[em]-delete.
.TP
\f[B]\[em]-check-date\f[R]
Can be used with -c and \[em]-encrypt or \[en]decrypt: When running
\f[B]msynk\f[R] with a config, the current date is stored in the config
file.
When running with \[em]-check-date, only files that have been modified
after the date stored in the config file are processed (by
passing\[en]date [date the config was last run] to \f[I]mkrypt\f[R]).
.TP
\f[B]\[em]-mkrypt-flag\f[R] arg
Additional argument for \f[I]mkrypt\f[R], for example to set the key for
the encryption.
Only pass one argument at a time, so for passing two use
`\[em]-mkrypt-flag \[lq]arg1\[rq] \[en]mkrypt-flag \[lq]arg2\[rq]'
.TP
\f[B]-d\f[R], \f[B]\[em]-delete\f[R]
\f[I]rsync\f[R] \[em]-delete option.
Deletes all files on the receiver that do not exist on the sender.
\f[I]msynk\f[R] will open \f[I]less\f[R] with a list of all files that
will be deleted and prompt you wether you want continue (unless
\[en]skip-dryrun is set)
.TP
\f[B]\[em]-skip-dryrun\f[R]
Can be used with \[em]-delete.
This skips listing the files that will be deleted and the prompt.
.TP
\f[B]\[em]-rsync-flag\f[R] arg
Additional argument for \f[I]rsync\f[R], for example to set the port for
the connection.
Only pass one argument at a time, so for passing two use
`\[em]-rsync-flag \[lq]arg1\[rq] \[en]rsync-flag \[lq]arg2\[rq]'
.TP
\f[B]-v\f[R], \f[B]\[em]-verbose\f[R]
Increase verbosity: Passes -v to rsync and mkrypt.
.TP
\f[B]\[em]-silent\f[R]
Decrease verbosity: Print only error messages and passes \[em]-silent to
mkrypt.
.TP
\f[B]\[em]-debug\f[R]
Maximum verbosity: -v but also print out rsync and mkrypt commands.
.TP
\f[B]\[em]-exclude\f[R]
Interpret positional arguments as blacklist, not whitelist.
.TP
\f[B]positional arguments\f[R]
If you are using a config file: pos.
args.
are strings that have to be contained in a path in order for it to be
synced.
If no pos.
args.
are given, all files are synced.
If you are not using a config file: pos.
args.
are filepaths relative to the sender directory.
.SH Troubleshooting
.SS Not enough space when using encryption
.PP
When using \[em]-encrypt, the data is encrypted to a temporary directory
$TMP_DIR, when using \[en]decrypt the encrypted date is copied to the
$TMP_DIR and then decrypted.
The $TMP_DIR defaults to /tmp/mksynk and /tmp is usually limited to half
the size of your memory.
You change the $TMP_DIR in the script in /usr/bin/msynk or temporarily
increase the size of the tmpfs by running \[lq]sudo mount -o
remount,size=XXG,noatime /tmp\[rq] if your $TMP_DIR is on /tmp and you
have at least XXGB memory+swap space.
.SH COPYRIGHT
.PP
Copyright \[co] 2022 Matthias Quintern.
License GPLv3+: GNU GPL version 3 <https://gnu.org/licenses/gpl.html>.
.PD 0
.P
.PD
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
.SH AUTHORS
Matthias Quintern.