KenKundert / emborg

Interactive command line interface to Borg Backup
GNU General Public License v3.0
94 stars 8 forks source link

Give the option to set verbose as default #13

Closed stefanobartoletti closed 4 years ago

stefanobartoletti commented 4 years ago

I think it would be helpful to have the ability to set the -v, --verbose options as default, maybe from withing the config files.

KenKundert commented 4 years ago

Okay, thanks. I will try to work that in.

stefanobartoletti commented 4 years ago

Thank you.

KenKundert commented 4 years ago

Done. It will take some time before this version makes its way to pypi.

stefanobartoletti commented 4 years ago

I've searched the docs, but I can't find how to set verbose as default. Can you help me?

KenKundert commented 4 years ago

Yeah, the documentation on the various options is thin. Sorry about that. To make verbose the default, simply add

verbose=True

in either the common or the configuration specific settings files.

And thanks for your suggestions. I think they were nice contributions.

stefanobartoletti commented 4 years ago

Thank you. I tried putting it both on common and specific configuration files, but it doesn't seem to work; calling emborg without the -v flag still runs it silently.

Has it to be put on a specific point of the config files?

KenKundert commented 4 years ago

Oh bummer. Not sure how this happened, but I messed this up. I have reopened this issue and I will try to release emborg again quickly. I have made some additional enhancements, so I need to be a careful, so it may take me a week or so.

stefanobartoletti commented 4 years ago

No problem, I was not sure if it was some mistake on my part.

By the way, thank you for your quick responses and for this nice software!

KenKundert commented 4 years ago

The fix is available in github. I will be updating pypi in the next few days.

KenKundert commented 4 years ago

Okay, I have done the release and now the latest version is up on pypi.

stefanobartoletti commented 4 years ago

There is probably a problem on my part, but I'm still unable to set verbose as default.

I added verbose=True to both the general and the specific config file, buth it doesn't seem to work.

I'm using the latest 1.9.0 version.

KenKundert commented 4 years ago

When you run emborg settings, does it acknowledge that verbose is True?

KenKundert commented 4 years ago

Whoops. Never mind. I have reproduced the problem.

KenKundert commented 4 years ago

It was partially working. Adding verbose=True to the settings file would add --verbose to the borg command line, but emborg would not show the output from borg. I have fixed that issue and pushed the change to github. Would you like to try the github version, or should I do a release so you can pick it up from pypi?

stefanobartoletti commented 4 years ago

I'm currently using the release from pypi. If you need to wait to release it there for some reasons, I have no hurry. :)

KenKundert commented 4 years ago

Okay, I have updated pypi. Please give it a try.

stefanobartoletti commented 4 years ago

Not working even with version 1.10.0.

This is the output of emborg settings:

               archive: '{user_name}-{config_name}-{{now}}'
    check_after_create: False
           compression: 'lz4'
           config_name: 'lamp'
        configurations: 'lamp home windows root all=lamp,home,windows'
 default_configuration: 'lamp'
            encryption: 'none'
        exclude_caches: True
    exclude_if_present: '.nobackup'
              excludes: [
                            '~/**/__pycache__',
                            '~/**/*.pyc',
                            '~/**/.*.swp',
                            '~/**/.*.swo',
                            '~/**/node_modules',
                            '~/**/vendor',
                        ]
            keep_daily: 7
          keep_monthly: 12
           keep_weekly: 4
           keep_within: '24H'
           keep_yearly: 1
       needs_ssh_agent: False
       one_file_system: True
    prune_after_create: True
      remote_ratelimit: 2000
            repository: '/run/media/stefano/DATA/backup/borg-sbweb-LAMP/'
              src_dirs: ['~/Apps/LAMP', '~/Apps/lamp_backup']
               verbose: True

Sorry for this nuisance, if there is any additional info that I can provide, please let me know.

KenKundert commented 4 years ago

I have tried again on version 1.10 and when I add 'verbose = True' to my settings or config file then the listing of the files that are backed-up are displayed on stdout, but are not saved to logfile. If instead I specify 'verbose = False' I do not see the listing of files on stdout, but they are placed in logfile. Is that what you are seeing?

Could you also give the contents of your 'lamp' config (I assume that is the configuration you are using). Finally, could confirm that 'verbose: True' is contained in the output of 'emborg settings'.

stefanobartoletti commented 4 years ago

The contents of generic settings configuration:

# These settings are common to all configurations

# configurations
configurations = 'lamp home windows root all=lamp,home,windows'
default_configuration = 'lamp'

# passcode
# specify either passphrase or avendesora_account
#passphrase = '<<passcode>>'              # passphrase for encryption key
#avendesora_account = '<<account-name>>'  # avendesora account holding passphrase
encryption = 'none'            # borg encryption method
    # Common choices are 'repokey' and 'keyfile'.
    # With 'repokey' the encryption key is copied into repository, use this
    # only if the remote repository is owned by you and is secure.
    # With 'keyfile' the encryption key is only stored locally. Be sure to
    # export it and save a copy in a safe place, otherwise you may not be
    # able to access your backups if you lose your disk.

# basic settings
# specify notify if batch and notifier if interactive
#notify = '<<your-email-address>>'        # who to notify when things go wrong
#notifier = 'notify-send -u normal {prog_name} "{msg}"'
                                         # interactive notifier program
needs_ssh_agent = False
remote_ratelimit = 2000                  # bandwidth limit in kbps
prune_after_create = True                # automatically run prune after a backup
check_after_create = False               # automatically run check after a backup

# repository settings
compression = 'lz4'
repository = '/run/media/sbweb/MyPassport/Backup/borg/sbweb-home/'
archive = '{user_name}-{config_name}-{{now}}'
    # These may contain {<name>} where name is any of host_name, user_name,
    # prog_name config_name, or any of the user specified settings.
    # Double up the braces to specify parameters that should be interpreted
    # by borg.

# filter settings
exclude_if_present = '.nobackup'
one_file_system = True
exclude_caches = True
verbose=True

# prune settings
keep_within = '24H'                       # keep all archives created in interval
#keep_hourly = 24                         # number of hourly archives to keep
keep_daily = 7                          # number of daily archives to keep
keep_weekly = 4                          # number of weekly archives to keep
keep_monthly = 12                        # number of monthly archives to keep
keep_yearly = 1                          # number of yearly archives to keep

and of specific lamp configuration:

repository = '/run/media/stefano/DATA/backup/borg-sbweb-LAMP/'

verbose=True

src_dirs = '''
    ~/Apps/LAMP
    ~/Apps/lamp_backup
'''.split()   # absolute path to directory to be backed up
excludes = '''
    ~/**/__pycache__
    ~/**/*.pyc
    ~/**/.*.swp
    ~/**/.*.swo
    ~/**/node_modules
    ~/**/vendor
'''.split()

A strange thing is that if I give this command pip3 search emborg, I get this:

emborg (1.10.0)  - Borg front end.
  INSTALLED: 1.10.0 (latest)

while emborg version gives me:

emborg version: 1.8.0 (2019-10-12) [Python 3.7.3].

Maybe the update went wrong somehow, I'll try to check this.

KenKundert commented 4 years ago

Perhaps try running: where emborg You may have two versions of emborg installed.

stefanobartoletti commented 4 years ago

I don't know why, but the executable wasn't updating; I've uninstalled and reinstalled again and now I'm running the correct version. It now works as expected!