- Check how much memory is left on the VPS.
- If 500M memory is left , reboot the VPS.
- Write a script that checks how much memory is left and reboot the VPS
- Add this script to crontab and for automatization
#!/bin/bash
mem=$(free -m | awk '/Mem:/{print $4}')
(( mem <= 500 )) && reboot
Make the script executablechmod +x scriptname
// note don't add an extensionAdd the script to the cron
crontab -e
* * * * * user_to_run_the_script /path/to/the/script
Post a Comment
Post a Comment