msynk/msynk.1
2022-03-12 01:02:04 +01:00

212 lines
5.7 KiB
Groff

.\" Automatically generated by Pandoc 2.14.2
.\"
.TH "MSYNK" "1" "March 2022" "msynk 1.0" ""
.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
.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 config file
\[ti]/.config/msynk/\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]-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]-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-flags\f[R] flags
Additional flags for \f[I]mkrypt\f[R].
You can use this to set the key for the encryption.
.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-flags\f[R] flags
Additional flags for \f[I]rsync\f[R].
You can use this to set the port for the connection.
.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]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 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.