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
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Source directly from /etc/default/anacron
  • Loading branch information
fgozzini committed Jun 15, 2022
commit 252f6da1b39e91ad260e7f1e43051ddd1295016d
10 changes: 2 additions & 8 deletions contrib/0anacron
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,9 @@ if [ `date +%Y%m%d` = "$day" ]; then
fi

# 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}'`
if [ $run_on_battery = "yes" ]; then
check_online=0
fi
fi
. /etc/default/anacron

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.


# Do not run jobs when on battery power
online=1
Expand Down