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

tools: added script to clean recycle bin for crontab #310

Merged
merged 1 commit into from
Apr 12, 2021
Merged

tools: added script to clean recycle bin for crontab #310

merged 1 commit into from
Apr 12, 2021

Conversation

Wine93
Copy link
Contributor

@Wine93 Wine93 commented Apr 8, 2021

What problem does this PR solve?

Problem Summary: Need a script to clean the recycle bin regularly

What is changed and how it works?

What's Changed: Added script.

How it Works: You can add this script to your crontab list to clean the recycle bin regularly, ex:

30 01 * * * /path/to/recylebin-clean -f -p 80 > /path/to/log

The above cron task means:

  • Execute the clean task at 1:30 am every day
  • Force clean recycle bin when get space information error (a large-capacity recycle bin may cause this error)
  • Otherwise, the recycle bin will be cleaned only when the recyclable percentage is greater than 80%

Side effects(Breaking backward compatibility? Performance regression?): none

Check List

  • Relevant documentation/comments is changed or added
  • I acknowledge that all my contributions will be made under the project's license

if [ "$recyclable" -eq -1 ]; then # Error
if [ "$force" -eq 1 ]; then
curve_tool "clean-recycle"
ret=$?; action=1
Copy link
Contributor

Choose a reason for hiding this comment

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

if force=0 , but it is still failed, nothing to do? (for example use option" -p 80 ", but timeout occured at 50% )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@SeanHai
yeap, if you want to clean cycle bin when an error occurred, you should specify -f option.

exit 0
;;
p)
percent=$OPTARG
Copy link
Contributor

Choose a reason for hiding this comment

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

if percent > 100, set to 100

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@SeanHai done

@ilixiaocui ilixiaocui merged commit 708e212 into opencurve:master Apr 12, 2021
ilixiaocui pushed a commit to ilixiaocui/curve that referenced this pull request Feb 6, 2023
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.

4 participants