Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
22 changes: 19 additions & 3 deletions btrfsmaintenance-refresh-cron.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,25 @@ export PATH

SCRIPTS=/usr/share/btrfsmaintenance

if [ -f /etc/sysconfig/btrfsmaintenance ]; then
. /etc/sysconfig/btrfsmaintenance
fi
# here we will try three times (by sleeping 1s) to check if
# the configuration file exists.
TRY_TIMES=0
while [ $TRY_TIMES -lt 3 ]; do
if [ ! -f /etc/sysconfig/btrfsmaintenance ]; then
sleep 1
else
break
fi
((TRY_TIMES++))
if [ $TRY_TIMES -eq 3 ];then
echo "Failed to find configuration file /etc/sysconfig/btrfsmaintenance"
exit 1
else
continue
fi
done

. /etc/sysconfig/btrfsmaintenance

if [ -f /etc/default/btrfsmaintenance ]; then
. /etc/default/btrfsmaintenance
Expand Down
2 changes: 1 addition & 1 deletion sysconfig.btrfsmaintenance
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ BTRFS_BALANCE_MOUNTPOINTS="/"
# The frequency may be specified using one of the listed values or
# in the format documented in the "Calendar Events" section of systemd.time(7),
# if available.
BTRFS_BALANCE_PERIOD="weekly"
BTRFS_BALANCE_PERIOD="monthly"

## Path: System/File systems/btrfs
## Type: string
Expand Down