Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mistake in user callback script example #1878

Closed
daveTheOldCoder opened this issue Sep 20, 2024 · 3 comments · Fixed by #1899
Closed

Mistake in user callback script example #1878

daveTheOldCoder opened this issue Sep 20, 2024 · 3 comments · Fixed by #1899

Comments

@daveTheOldCoder
Copy link

There's a mistake in the example of a user callback script on this page: https://backintime-docs.readthedocs.io/en/latest/user-callback/

I don't know if that page is current documentation, or if this issue should have been posted in the "doc" or "user callback" repository.

This command will fail if the directory $HOME/.local/state does not exist:
touch $HOME/.local/state/backintime_callback_log

That will prevent backintime from taking the snapshot.

That page also states that the script should return $0$. I assume that's supposed to be 0.

Here's an improved example script:

#!/bin/bash

LOG_FILE='/tmp/backintime_callback.log'

# Get current time
current_time=$(date +"%Y-%m-%d %H:%M:%S")

# Create file if it does not exist.
touch "$LOG_FILE"

# Append current time to the file.
echo -n "{$current_time}: " >> "$LOG_FILE"

# Iterate through all arguments.
for arg in "$@"
do
    # Append argument to the file.
    echo -n "$arg," >> "$LOG_FILE"
done

# Append newline character.
echo >> "$LOG_FILE"

exit 0
@buhtz
Copy link
Member

buhtz commented Sep 20, 2024

Thank you for reporting this. It is intended to be posted here. We will soon integrate the two other repos in this main repo.

@buhtz
Copy link
Member

buhtz commented Oct 10, 2024

Hello Dave,
please see PR #1899 that should fix your issue.
Please have a special look at the file doc/manual/src/user-callback.md. It contains the by you modified user-callback example. I put SPDX meta data to it and a license. Please let me know if the license (CC0-1.0 / public domain) is OK for you. Don't hesitate to ask.

Again thank you very much for your contribution. We appreciate it!

Best wishes,
Christian

@daveTheOldCoder
Copy link
Author

The CC0-1.0 license is fine. I have no problem with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants