Can't invoke scripts before/after #199

Closed
opened 2019-06-30 23:40:42 +00:00 by thisfro · 3 comments

What I'm trying to do and why

Run a script before and after the actual backup process

Steps to reproduce (if a bug)

/etc/borgmatic.d/nextcloud.yaml has those lines:

hooks:
    before_backup:
        - sudo -u www-data php /var/www/cloud/occ maintenance:mode --on
        - /opt/borg-scripts/bkp_nextcloud.sh

    after_backup:
        - sudo -u www-data php /var/www/cloud/occ maintenance:mode --off

then I run sudo borgmatic --verbosity 2 -c /etc/borgmatic.d/nextcloud.yaml

Actual behavior (if a bug)

summary:  
/etc/borgmatic.d/nextcloud.yaml: Error parsing configuration file. 
An error occurred while parsing a configuration file at /etc/borgmatic.d/nextcloud.yaml:  
while scanning for the next token 
found character that cannot start any token 
  in "/etc/borgmatic.d/nextcloud.yaml", line 197, column 1

Expected behavior (if a bug)

Run the command

Other notes / implementation ideas

Line 197 is the first before command.
I also tried the "standard" command (echo "Starting a backup job.") in the yaml config, same result
Am I missing something or is this a bug (can't be the first one)?

Environment

borgmatic version: [1.3.12]

borgmatic installation method: pip

Borg version: 1.1.9

Python version: 3.5.2

operating system and version: Ubuntu 16.04, 4.15.0-52-generic

#### What I'm trying to do and why Run a script before and after the actual backup process #### Steps to reproduce (if a bug) `/etc/borgmatic.d/nextcloud.yaml` has those lines: ``` hooks: before_backup: - sudo -u www-data php /var/www/cloud/occ maintenance:mode --on - /opt/borg-scripts/bkp_nextcloud.sh after_backup: - sudo -u www-data php /var/www/cloud/occ maintenance:mode --off ``` then I run `sudo borgmatic --verbosity 2 -c /etc/borgmatic.d/nextcloud.yaml` #### Actual behavior (if a bug) ``` summary: /etc/borgmatic.d/nextcloud.yaml: Error parsing configuration file. An error occurred while parsing a configuration file at /etc/borgmatic.d/nextcloud.yaml: while scanning for the next token found character that cannot start any token in "/etc/borgmatic.d/nextcloud.yaml", line 197, column 1 ``` #### Expected behavior (if a bug) Run the command #### Other notes / implementation ideas Line 197 is the first before command. I also tried the "standard" command (`echo "Starting a backup job."`) in the yaml config, same result Am I missing something or is this a bug (can't be the first one)? #### Environment **borgmatic version:** [1.3.12] **borgmatic installation method:** pip **Borg version:** 1.1.9 **Python version:** 3.5.2 **operating system and version:** Ubuntu 16.04, 4.15.0-52-generic
thisfro reopened this issue 2019-06-30 23:40:55 +00:00
Owner

Thank you for reporting this! I managed to get a reproduction of the same error message by using tabs to indent the hook command lines instead of spaces. If you indeed have tabs there, could you try replacing them with the requisite number of spaces?

Thank you for reporting this! I managed to get a reproduction of the same error message by using tabs to indent the hook command lines instead of spaces. If you indeed have tabs there, could you try replacing them with the requisite number of spaces?
witten added the
question / support
label 2019-06-30 23:50:07 +00:00
Author

Yes that's absolutely the case! Didn't even realize... Thx alot!

Yes that's absolutely the case! Didn't even realize... Thx alot!
Owner

Glad that was it! I'm adding info about this to the documentation, as it's not at all obvious from the error message. Thanks again for filing.

Glad that was it! I'm adding info about this to the documentation, as it's not at all obvious from the error message. Thanks again for filing.
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#199
No description provided.