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

schedule.time should specify 'hour' but seems to specify 'minute' #1270

Closed
Whytey opened this issue Aug 15, 2022 · 4 comments
Closed

schedule.time should specify 'hour' but seems to specify 'minute' #1270

Whytey opened this issue Aug 15, 2022 · 4 comments

Comments

@Whytey
Copy link

Whytey commented Aug 15, 2022

Using backintime version 1.3.2 from the command line only. No GUI installed.

root@server1:~/backintime# backintime --version
backintime 1.3.2

I have three profiles. I intended to run profile 1 and 2 daily at 1am and 2am respectfully. Profile 3 should be run every Sunday at 3am.

Config snippet:

profile1.name=filesystem
profile1.schedule.mode=20
profile1.schedule.time=1

profile2.name=databases
profile2.schedule.mode=20
profile2.schedule.time=2

profile3.name=containers
profile3.schedule.mode=30
profile3.schedule.time=03
profile3.schedule.weekday=7

When I run check_config, it goes through the process of creating the crontab entries, but seems to specify the times as 1, 2 and 3 minutes past midnight:

root@server1:~/backintime# crontab -l
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

#Back In Time system entry, this will be edited by the gui:
1 0 * * * /usr/bin/nice -n19 /usr/bin/ionice -c2 -n7 /usr/bin/backintime --config /root/backintime/backintime.config backup-job >/dev/null 2>&1
#Back In Time system entry, this will be edited by the gui:
2 0 * * * /usr/bin/nice -n19 /usr/bin/ionice -c2 -n7 /usr/bin/backintime --profile-id 2 --config /root/backintime/backintime.config backup-job >/dev/null 2>&1
#Back In Time system entry, this will be edited by the gui:
3 0 * * 7 /usr/bin/nice -n19 /usr/bin/ionice -c2 -n7 /usr/bin/backintime --profile-id 3 --config /root/backintime/backintime.config backup-job >/dev/null 2>&1

Seems like a bug to me.

Cheers,
Whytey

@aryoda
Copy link
Contributor

aryoda commented Aug 22, 2022

Did you create the profile manually? And what does the BiT GUI show as schedule time for this config/profile?

IMHO the time is a number but NOT the hour but a decimal-codes system of the form:

hhmm

So 1 o'clock should be 'profile2.schedule.time=200' (for hour = 2 and minutes = 00).

See the code for this: https://github.com/bit-team/backintime/blob/master/common/config.py#L1507

Please set the Hour of the schedule in the BiT GUI under "Settings" and check how the schedule.time is modified then
(I hope as I found it in the code).

@Whytey
Copy link
Author

Whytey commented Aug 23, 2022

Hi,

I am not running the GUI (I am on a headless server so hand-crafted my own config). Your investigation into the code seem sound so I updated my config and it does seem to have fixed things perfectly, thankyou.

I will leave this ticket open though, since I think there is still a defect (but in the documentation, now), since I used the man pages to guide me and that seems to indicate that schedule.time should be in the range of 0-24 - https://manpages.ubuntu.com/manpages/jammy/man1/backintime-config.1.html

Thanks for your help.

@aryoda
Copy link
Contributor

aryoda commented Aug 23, 2022

@Whytey Thanks for reporting, backtesting and clarifying the issue, I fully agree that this is no bug in the code of BiT but a documentation problem in the man page file https://github.com/bit-team/backintime/blob/master/common/man/C/backintime-config.1#L147

@Codeberg-AsGithubAlternative-buhtz I could create a pull request but I guess it is easier for you to fix the documentation directly since you have commit rights on the repo.

Instead of

Only valid for profile.schedule.mode >= 20 ... Only valid for profile.schedule.mode >= 20

which is wrong since hour and minute in the source code is also used for the modes WEEK, MONTH and YEAR
but not for REPEATEDLY = 25 and UDEV = 27 (even though their modes are also above 20!).

https://github.com/bit-team/backintime/blob/master/common/config.py#L1576

I suggest to modify the backintime-config man page like this:

.IP "\fIprofile<N>.schedule.time\fR" 6
.RS
Type: int       Allowed Values: 0-2400
.br
Position-coded number with the format "hhmm" to specify the hour and minute the cronjob should start (eg. 2015 means a quarter past 8 pm).
.br
Only valid for \fIprofile<N>.schedule.mode\fR = 20 (daily), 30 (weekly), 40 (monthly) and 80 (yearly)
.PP
Default: 0
.RE

You can test the correct rendering of the man page with

man -l backintime-config.1

@buhtz
Copy link
Member

buhtz commented Aug 23, 2022

Awesome. ;)

I don't have commit rights yet. But I work on it. ;) I would suggest you open a PR and mention @emtiu in the comment. He has the rights currently.

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

No branches or pull requests

3 participants