Fix local variable usage in acronis-agent-status.sh
Fixed error where 'local' keyword was used outside of a function in the storage status section. Changed to regular variable declarations and added null check for use_percent to prevent integer expression errors. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -182,16 +182,16 @@ echo ""
|
||||
# Check disk space for backups
|
||||
echo -e "${BOLD}Storage Status:${NC}"
|
||||
if [ -d "/var/lib/Acronis" ]; then
|
||||
local backup_dir_size=$(du -sh /var/lib/Acronis 2>/dev/null | awk '{print $1}')
|
||||
backup_dir_size=$(du -sh /var/lib/Acronis 2>/dev/null | awk '{print $1}')
|
||||
echo -e " Acronis data: ${backup_dir_size}"
|
||||
|
||||
# Check free space
|
||||
local free_space=$(df -h /var/lib/Acronis | tail -1 | awk '{print $4}')
|
||||
local use_percent=$(df -h /var/lib/Acronis | tail -1 | awk '{print $5}' | tr -d '%')
|
||||
free_space=$(df -h /var/lib/Acronis | tail -1 | awk '{print $4}')
|
||||
use_percent=$(df -h /var/lib/Acronis | tail -1 | awk '{print $5}' | tr -d '%')
|
||||
|
||||
echo -e " Free space: ${free_space}"
|
||||
|
||||
if [ "$use_percent" -gt 90 ]; then
|
||||
if [ -n "$use_percent" ] && [ "$use_percent" -gt 90 ] 2>/dev/null; then
|
||||
echo -e " ${RED}⚠ Warning: Disk usage at ${use_percent}%${NC}"
|
||||
fi
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user