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

Allow user to run anacron jobs on battery #115

Merged
merged 3 commits into from
Jan 9, 2023
Merged

Conversation

fgozzini
Copy link
Contributor

The user can allow running anacron jobs on battery by adding the string ANACRON_RUN_ON_BATTERY_POWER=yes to the file /etc/default/anacron.

The user can allow running anacron jobs on battery by adding the string `ANACRON_RUN_ON_BATTERY_POWER=yes` to the file `/etc/default/anacron`.
contrib/0anacron Outdated
# Check whether run on battery should be allowed
check_online=1
if test -r /etc/default/anacron; then
run_on_battery=`grep ANACRON_RUN_ON_BATTERY_POWER /etc/default/anacron | awk -F'=' '{print $2}'`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about just sourcing in the file? i.e., . /etc/default/anacron

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, as I said I am no expert in bash scripting. I pushed your suggestion into the branch.

@t8m
Copy link
Member

t8m commented Jun 15, 2022

Nice, it would be also nice if it was documented somewhere, however I do not see the right place. Manual page for anacron might be the place however as this is handled by the 0anacron script which might not necessarily be used, it is not so clear.

@fgozzini
Copy link
Contributor Author

What about the crond manpage?

contrib/0anacron Outdated

if [ $check_online = 1 ]; then
if [ $ANACRON_RUN_ON_BATTERY_POWER != "yes" ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add double quotes: "$ANACRON_RUN_ON_BATTERY_POWER".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@t8m
Copy link
Member

t8m commented Jun 15, 2022

What about the crond manpage?

I do not think it belongs there at all. Maybe there should be a 0anacron manpage in the section 8 which could be linked from anacron manpage?

@fgozzini
Copy link
Contributor Author

So do you suggest to create a new manpage just for this?

@t8m
Copy link
Member

t8m commented Jun 17, 2022

So do you suggest to create a new manpage just for this?

Yeah. But it is up to you if you want to create it.

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

Successfully merging this pull request may close these issues.

None yet

2 participants