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

🧹 fix+refact(system-cleanup) #856

Merged

Conversation

adamperkowski
Copy link
Collaborator

Type of Change

  • Bug fix
  • Refactoring
  • UI/UX improvement

Testing

Works :)

Issues / other PRs related

Checklist

  • My code adheres to the coding and style guidelines of the project.
  • I have performed a self-review of my own code.
  • My changes generate no errors/warnings/merge conflicts.

@adamperkowski adamperkowski changed the title fix(system-cleanup): some issues fix+refact(system-cleanup): some issues Oct 20, 2024
@adamperkowski adamperkowski changed the title fix+refact(system-cleanup): some issues fix+refact(system-cleanup) Oct 20, 2024
Comment on lines +35 to +43
if [ -d /var/tmp ]; then
"$ESCALATION_TOOL" find /var/tmp -type f -atime +5 -delete
fi
if [ -d /tmp ]; then
"$ESCALATION_TOOL" find /tmp -type f -atime +5 -delete
fi
if [ -d /var/log ]; then
"$ESCALATION_TOOL" find /var/log -type f -name "*.log" -exec truncate -s 0 {} \;
fi
Copy link
Contributor

@jeevithakannan2 jeevithakannan2 Oct 20, 2024

Choose a reason for hiding this comment

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

Can we do something like this ? This will not return non zero if the dir is not found

Suggested change
if [ -d /var/tmp ]; then
"$ESCALATION_TOOL" find /var/tmp -type f -atime +5 -delete
fi
if [ -d /tmp ]; then
"$ESCALATION_TOOL" find /tmp -type f -atime +5 -delete
fi
if [ -d /var/log ]; then
"$ESCALATION_TOOL" find /var/log -type f -name "*.log" -exec truncate -s 0 {} \;
fi
"$ESCALATION_TOOL" find /var/tmp -type f -atime +5 -delete &> /dev/null || true
"$ESCALATION_TOOL" find /tmp -type f -atime +5 -delete &> /dev/null || true
"$ESCALATION_TOOL" find /var/log -type f -name "*.log" -exec truncate -s 0 {} \; &> /dev/null || true

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We could but if user doesnt have perms for a file (could happen and will happen with /tmp) it'll fail too

Copy link
Contributor

@jeevithakannan2 jeevithakannan2 Oct 20, 2024

Choose a reason for hiding this comment

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

The cmd is escalated so is less likely to fail due to perm err

@ChrisTitusTech ChrisTitusTech merged commit e3688e9 into ChrisTitusTech:main Oct 24, 2024
3 checks passed
@adamperkowski adamperkowski deleted the system_cleanup_issues branch October 24, 2024 20:06
@adamperkowski adamperkowski changed the title fix+refact(system-cleanup) 🧹 fix+refact(system-cleanup) Oct 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Full System Cleanup doesn't clean Trash if it errors out on cleaning cache
3 participants